home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / infor / dosref.zip / DOSREF22 next >
Text File  |  1993-03-19  |  846KB  |  16,302 lines

  1.  
  2.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  3.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  4. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  5.                      ISBN 1-878830-02-3 (disk-based text)
  6.                     Copyright (c) 1987, 1992 Dave Williams
  7.                         ┌─────────────────────────────┐
  8.                         │ Shareware Version, 03/16/92 │
  9.                         │  Please Register Your Copy  │
  10.                         └─────────────────────────────┘
  11.  
  12.  
  13.   /* This work is registered directly with the copyright offices of the     */
  14.   /* United States and of the United Kingdom, and indirectly in many other  */
  15.   /* nations via the conventions the above are signatory to.                */
  16.   /*           Generous licensing terms are available on inquiry.           */
  17.  
  18.  
  19.  
  20.                             I N T R O D U C T I O N
  21.  
  22.  
  23.  This book is a technical reference. It is NOT a tutorial. Hopefully, this
  24. book is what you'll reach for when you want find out what Peter Norton or the
  25. "official" references glossed over.
  26.  
  27.  This manual is intended to replace the various (expensive) references needed
  28. to program for the DOS environment, that stack of magazines threatening to take
  29. over your work area, and those odd tables and charts you can never find when
  30. you need them.
  31.  
  32.  The various Microsoft and IBM publications and references don't always have
  33. the same information. This has caused some consternation about the
  34. "undocumented" features to be found in DOS. In general, if a call doesn't
  35. appear in the IBM DOS Technical Reference it is considered "undocumented"
  36. although it may be documented by other OEMs or by later Microsoft tech
  37. bulletins.
  38.  
  39.  The information here is valid for DOS 2.x through 5.x. Where there are
  40. differences between the two versions there are notes in the text. No great
  41. effort was expended on DOS 1.x.
  42.  
  43.  When I started writing this book, it was originally for my own personal use.
  44. Then I began expanding it with the idea of getting it published, since at that
  45. time there was *nothing* in print like it. (late 1987) If I had managed to
  46. send it off to the publishers early enough, I would have had it made. As it
  47. was I lost six months having a nice steel rod put in my leg after being run
  48. over by a drug addict in an uninsured car, and half a dozen similar books were
  49. published by then, and nobody was interested in mine. Six months is a long
  50. time in the PC world.
  51.  
  52.  That's why I'm uploading this file as "user-supported." It gives me a chance
  53. to recoup a few bucks for the time I've been working on this thing, and it
  54. gives some advantages that a printed book can't - first, you can load it on
  55. your hard disk and use Vern Buerg's LIST or SideKick to scan through text. You
  56. can grab a piece of something and paste it into a document, etc. If you help
  57. support the Reference you will always have the latest version available; you
  58. can't "upgrade" books.
  59.  
  60.  A project this size takes a LOT of time and effort. I've tried to verify as
  61. much of the information I've received as I could, but there's just too much for
  62. absolute certainty.  The TechRef has been in the hands of some heavy-duty code
  63. jockeys for a couple of years now with very few bug reports, though.
  64.  
  65.  If you find any typos, incorrect information, or want to see something else,
  66. let me know. If you have any more detailed information on something, PLEASE let
  67. me know!
  68.  
  69.                                                         Dave Williams
  70.  
  71.  
  72.  
  73.                          D  I  S  C  L  A  I  M  E  R
  74.  
  75. <sigh>
  76.  
  77.  As is common these days, I have to make a "Notice of Disclaimer". I take no
  78. responsibility for anything, and if anything you do with this book ruins you
  79. for life or makes your dog bite you, or anything else, that's just tough.
  80.  
  81.  I hope you find much use for this reference. It was a trip to write, too.
  82.  
  83.                                                         Dave Williams
  84.  
  85.                                                   (C) Copyright 1987, 1992
  86.  
  87. /* note: the above disclaimer is being used as an example in the University */
  88. /*       of Texas' School of Law. Whether good or bad, my respondent didn't */
  89. /*       say...                                                             */
  90.  
  91.  
  92. ______________________________________________________________________________
  93.  
  94. Copyrights and trademarks:
  95.  
  96. (3COM Corporation)
  97.  3COM, Etherlink
  98.  
  99. (Allied Telephone and Telegraph)
  100.  UNIX, AT&T
  101.  
  102. (Artisoft)
  103.  LANtastic
  104.  
  105. (AST Corporation)
  106.  AST, RAMpage!
  107.  
  108. (Atari Computer)
  109.  Atari, ST, TOS
  110.  
  111. (Borland)
  112.  Borland, Turbo C, Turbo Pascal, Turbo Lightning, Turbo Assembler, SideKick
  113.  
  114. (Commodore Business Machines)
  115.  Amiga 2000, Bridge Board
  116.  
  117. (Compaq Computer Corp.)
  118.  Compaq, Deskpro
  119.  
  120. (Cordata Computer)
  121.  Corona, Cordata
  122.  
  123. (Cove Software)
  124.  CED, PCED
  125.  
  126. (Digital Equipment Company)
  127.  DEC, Rainbow, DECMate, DOS    (uh... yeah. DEC owns the trademark to 'DOS')
  128.  
  129. (Fox Research, Inc.)
  130.  10-Net
  131.  
  132. (Graphic Software Systems)
  133.  GSS, DGIS
  134.  
  135. (Hayes)
  136.  Smartmodem
  137.  
  138. (Hercules Computer Technology)
  139.  Hercules, HGC, Hercules Graphics Card Plus, InColor Card
  140.  
  141. (IBM Corp.)
  142.  IBM, PC, PCjr, PC/XT, PC/AT, XT/286, PS/2, TopView, Micro Channel, 3270 PC,
  143.  RT PC, Token Ring, OS/2
  144.  
  145. (Intel Corp.)
  146.  Intel, iAPX286, iAPX386, LIM EMS, Communicating Applications Standard (CAS)
  147.  
  148. (Logitech, Inc)
  149.  Logitech, Logimouse
  150.  
  151. (Microsoft Corp.)
  152.  Microsoft, MS, MS DOS, OS/2, Xenix, Windows, Windows/286, Windows/386,
  153.  Microsoft Networks, LIM EMS, XMA, DPMI
  154.  
  155. (Mouse Systems Corp.)
  156.  Mouse Systems, PCMouse
  157.  
  158. (Novell Development Corp.)
  159.  Novell, NetWare
  160.  
  161. (Phar Lap)
  162.  VCPI, Virtual Control Program Interface
  163.  
  164. (Qalitas)
  165.  386-To-The-Max, 386MAX
  166.  
  167. (Quarterdeck Office Systems)
  168.  DesQview, QEMM
  169.  
  170. (SEAware, Inc)
  171.  ARC
  172.  
  173. (Softlogic)
  174.  DoubleDOS
  175.  
  176. (Sunny Hill Software)
  177.  TaskView, OmniView
  178.  
  179. (Tandy Corp.)
  180.  Tandy, Radio Shack, DeskMate
  181.  
  182. (Texas Instruments)
  183.  TI, TI Professional, Business Professional, TIGA (TI Graphics Interface)
  184.  
  185. (Zenith Radio Corporation)
  186.  Zenith, Z-100, Z-248
  187.  
  188. (ZSoft Corporation)
  189.  ShowPartner, Paintbrush
  190.  
  191.  "LIM 4.0" and "Expanded Memory Specification" are copyright Lotus Development
  192. Corp, Intel Corp, and Microsoft Corp.
  193.  
  194.  "EEMS", "AQA 3.1" and "Enhanced Expanded Memory Specification" are copyright
  195. by Ashton-Tate, Quadram, and AST
  196.  
  197.  "DPMI" and "DOS Protected Mode Interface" are copyright Lotus Development
  198. Corp, Intel Corp, Microsoft Corp, and AST
  199.  
  200. Various other names are trademarks of their respective companies.
  201.  
  202. ╔════════════════════════════════════════════════════════════════════════════╗
  203. ║     Programmer's Technical Reference for MSDOS and the IBM PC     SWv2.3   ║
  204. ╚════════════════════════════════════════════════════════════════════════════╝
  205.  
  206.   This is a user-supported technical reference.  If you find this information
  207.  to be of use, please mail your check or money order for US $20 + $1.75 S&H to:
  208.  
  209.                        ╤═════════════════════════════╤
  210.                        │    Dave Williams, DOSREF    │
  211.                        │         PO Box 181          │
  212.                        │ Jacksonville, AR 72076-0181 │
  213.                        │             USA             │
  214.                        ╧═════════════════════════════╧
  215.  
  216.   Shipping is US Postal Service Air Mail.  For non-Australian foreign orders,
  217.  see the file 'PAYMENT'.  Site licensing and product licensing terms are
  218.  available.
  219.  
  220.   If you wish to make payment in Australian dollars, please mail your check
  221.  or money order for AUS $29 or credit card information to to:
  222.  
  223.                        ╤═════════════════════════════╤
  224.                        │ Spearwood Shareware Service │
  225.                        │          PO Box 121         │
  226.                        │    Hamilton Hill, WA 6163   │
  227.                        │           Australia         │
  228.                        ╧═════════════════════════════╧
  229.  
  230.         Spearwood Shareware Service is our authorized Australian dealer.
  231.         They will forward your order to the USA and you will receive the
  232.         absolute latest version of DOSREF by airmail straight from the
  233.         author.  This means there will be about a three week delay before
  234.         your order arrives.  We appreciate your business!
  235.  
  236.         Spearwood is our dealer only; for support write or E-mail the
  237.         author, Dave Williams, at the above address.
  238.  
  239. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  240.  
  241.    Why support DOSREF instead of relying on one of those public domain
  242.  "interrupt lists"?  Sheer size, for one.  Even in LHarc format DOSREF
  243.  bulks out to over a megabyte, making it too large for most sysops to
  244.  consider keeping online.  Registered users also get support via:
  245.  
  246.         The Courts of Chaos BBS (DOSREF support board)
  247.         RIME/RelayNet
  248.         BIX
  249.         internet
  250.         CompuServe
  251.         airmail
  252.  
  253.   You get the very latest edition of this manual on disk, with no worries
  254.  about corrupted or tampered text.  DOSREF is a quality product, in use
  255.  by the US Navy, CalTech, Borland, NEC, Wang, General Motors, Citicorp,
  256.  Rockwell, Honeywell, Digital Research, Central Point Software, 20th Century
  257.  Fox, Associated Press, hospitals, universities, and government agencies
  258.  around the world.
  259.  
  260.   The Registered User reference consists of over a megabyte of the compressed
  261.  technical reference, appendices, and sample source code. That's about three
  262.  megabytes of raw data when uncompressed, or several times larger than the
  263.  shareware version.
  264.  
  265.   The Registered User version contains information on device drivers, mouse
  266.  programming, Virtual Control Program Interface, hard drives, hardware
  267.  information, virus and Trojan programs, EMS 3.2, LIM 4.0, EEMS 3.2, CD-ROM,
  268.  network programming, DOS 5.0, and more.
  269.  
  270.   Registered users will be advised by mail of updates.
  271.  
  272.   Several people who have downloaded copies over four years old have written
  273.  to see if I was still supporting the Reference.  The answer is yes.  Not only
  274.  that, but my book contract calls for keeping the information current.  If
  275.  you're concerned, just drop a postcard.
  276.  
  277.  *****************************************************************************
  278.  
  279.  Foreign langauge versions are available!
  280.  
  281.   Klaus Overhage of Stuttgart, West Germany has licensed DOSref for
  282.  redistribution and is now able to provide versions in German.  Klaus' version
  283.  is a separate product from this one and must be purchased separately. Klaus
  284.  is providing full support for German users.  If you'd like a copy in German,
  285.  please contact:
  286.  
  287.                              Klaus Overhage
  288.                              Rosenstrasse 15 A
  289.                              7000 Stuttgart 50
  290.                              Germany
  291.  
  292.   I hope to have other languages available soon.  If you are interested in
  293. purchase or translation, please contact me for details.
  294.  
  295.  *****************************************************************************
  296.  
  297.   For payment in British pounds, Canadian dollars or EuroCheques, see
  298.  INVOICE.TRF and PAYMENT.  I fully support foreign users!  If you're having
  299.  trouble arranging payment, write (or leave EMail) and I'll try to work
  300.  something out.
  301.  
  302.   Do you live outside the US?  If so, you're probably familiar with the
  303.  hassles of keeping up with the latest information - the three to five month
  304.  lead time for US publication, plus time for local book dealers to catalog
  305.  new releases, plus problems in trying to order... plus the delays while your
  306.  book comes in on special order, goes through Customs, the inevitable price
  307.  hikes through all the middlemen, taxes...  not only is DOSREF priced
  308.  well below the price of good printed computer books in the US, it's probably
  309.  far cheaper than you could expect to pay for US books locally.  Plus your
  310.  order will show up in your very own mailbox by air mail.
  311.  
  312.  *****************************************************************************
  313.  
  314.   Printed copies of the Tech Ref are available for £16.95 or US$35.10 from
  315. Sigma Press, marketed by John Wiley & Sons UK. Address orders to:
  316.  
  317.         Programmer's Technical Reference
  318.         by Dave Williams
  319.  
  320.         ISBN 185058-199-1
  321.         John Wiley & Sons
  322.         Baffins Lane
  323.         Chichester
  324.         West Sussex PO19 1UD
  325.         England
  326.  
  327.  They accept checks, most credit cards, or purchase orders.
  328.  
  329.  *****************************************************************************
  330.  
  331.   The latest shareware version is always available on BIX the ibm.dos/listings
  332.  area, the GEnie IBM file area, or:
  333.  
  334.  The Courts of Chaos, (501)985-0059, (support BBS)  CompuCom 9600
  335.  The Cat House, (501)376-6909,  (sysop: Joe Felix)  CompuCom 9600
  336.  
  337.  RelayNet node ->CHAOS
  338.     send mail in COMMON or MULTITSK (I'm the Conference Host for Multitask)
  339.  
  340.  GroupMed, (206) 581-9088  (sysop: Ismail Arslangiray)
  341.  Tacoma WA, USA  FIDOnet 1:138/120 2400bps, 1:138/116 9600bps USR HST
  342.  instant access, latest DOSREF is FREQable
  343.  
  344.  The Drake BBS   Sysop: Paolo Masetti   Cosysop: Roberto Bianchi
  345.  Langhirano, Italy, 0522 828800 <- 9600 v32
  346.                          824379 <- 2400 mnp5
  347.  Fidonet node 2:332/502
  348.  
  349.  
  350.                                How to use DOSREF
  351.  
  352.  This reference changes so often that any attempt to format it for pagination 
  353. would be a tremendous waste of time. Simply printing the thing out and letting 
  354. the pagebreaks fall where they may is how most people do it. The neatest 
  355. solution is Vern Buerg's LIST.COM or SideKick's file view function. If your
  356. editor has multiple-window support, you can open a small window into the 
  357. Reference and cut and paste into your source.
  358.  
  359.  An efficient method of using the Reference is to concatenate all the chapters 
  360. together with the COPY command, ie COPY CONTENTS + CHAPTER.001 + CHAPTER.002 +
  361. ..... + CHAPTER.017   REF.  (REF being the new file name for the concatenated 
  362. files.) With LIST.COM, the backslash (\) or F9 key will search for strings. 
  363. You can then dump pieces of text to a disk file or your printer.
  364.  
  365.  If you work better with a printout than scanning with a file viewer, try 
  366. setting your printer to 132 columns. This allows a nice margin for writing 
  367. notes and eliminates the problem some printers have when printing 80 
  368. character wide text. Some of the text and charts in the reference are a full 
  369. 80 columns wide; unfortunately some printers wrap automatically at 79 columns.
  370. Some printers don't handle a combination of compressed print and graphics 
  371. characters very well either. You may have to use the PRTRFIX.COM program 
  372. provided on Disk 1 to squelch the graphics for printing.
  373.  
  374.  I strongly recommend using a viewer instead of printing. If you *must* print 
  375. the Reference out, do it in stages so your printer does not overheat. Some
  376. inexpensive printers will self-destruct after a couple of hours.
  377.  
  378.  
  379.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  380.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  381. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  382.                      ISBN 1-878830-02-3 (disk-based text)
  383.                     Copyright (c) 1987, 1992 Dave Williams
  384.                         ┌─────────────────────────────┐
  385.                         │ Shareware Version, 03/16/92 │
  386.                         │  Please Register Your Copy  │
  387.                         └─────────────────────────────┘
  388.  
  389.  
  390.  The rest of the chapters aren't included in this shareware demonstration
  391. package.  Since the complete manual takes about 1000k even compressed in
  392. LHarc format, something had to give somewhere.
  393.  
  394.  Here's a sample of what you're missing:
  395.  
  396.  DOS 5 information (mainly in registered chapters 4, and 5)
  397.  
  398.  Appendices             Mouse API               Networking
  399.  
  400.  EMS                    XMS                     VCPI
  401.  
  402.  Video                  chip-level stuff        MORE!
  403.  
  404.  
  405.  
  406.                                TABLE OF CONTENTS
  407.  
  408.  
  409. INTRO           Introduction, credits, copyrights
  410.  
  411.  
  412. CHAPTER 1       DOS and the PC
  413.  
  414. Some History .......................................................... 1**1
  415. What is DOS? .......................................................... 1**2
  416. Other Operating Systems ............................................... 1**3
  417. Specific Versions of MS/PC-DOS ........................................ 1**4
  418. The Operating System Heirarchy ........................................ 1**5
  419. DOS Structure ......................................................... 1**6
  420. DOS Initialization .................................................... 1**7
  421.  
  422.  
  423. CHAPTER 2       Low Memory and Absolute Addresses
  424.  
  425. Introduction .......................................................... 2**1
  426. System Memory Map ..................................................... 2**2
  427. A Brief Guide to Current Memory Terminology ........................... 2**3
  428. PC Port Assignment .................................................... 2**4
  429. Reserved Memory Locations ............................................. 2**5
  430. Absolute Addresses .................................................... 2**6
  431. The IBM PC System Interrupts (Overview) ............................... 2**7
  432. Quick Chart of Interrupts 00h-0FFh .................................... 2**8
  433. The IBM-PC System Interrupts 00h-0Fh (in detail) ...................... 2**9
  434.  
  435.  
  436. CHAPTER 3       The IBM ROM BIOS
  437.  
  438. Calling the ROM BIOS .................................................. 3**1
  439. Interrupt 10h  Video Services ......................................... 3**2
  440. Interrupt 11h  Equipment Check ........................................ 3**3
  441. Interrupt 12h  Memory Size ............................................ 3**4
  442. Interrupt 13h  Disk Functions ......................................... 3**5
  443. Interrupt 14h  Initialize and Access Serial Port ...................... 3**6
  444.                FOSSIL Drivers ......................................... 3**7
  445. Interrupt 15h  Cassette I/O ........................................... 3**8
  446. Interrupt 16h  Keyboard I/O ........................................... 3**9
  447. Interrupt 17h  Printer ................................................ 3**10
  448. Interrupt 18h  ROM BASIC .............................................. 3**11
  449. Interrupt 19h  Bootstrap Loader ....................................... 3**12
  450. Interrupt 1Ah  Time of Day ............................................ 3**13
  451. Interrupt 1Bh  Control-Break .......................................... 3**14
  452. Interrupt 1Ch  Timer Tick ............................................. 3**15
  453. Interrupt 1Dh  Vector of Video Initialization Parameters .............. 3**16
  454. Interrupt 1Eh  Vector of Diskette Controller Parameters ............... 3**17
  455. Interrupt 1Fh  Ptr to Graphics Character Extensions (Graphics Set 2) .. 3**18
  456.  
  457.  
  458. CHAPTER 4       DOS Function Requests
  459.  
  460. General Programming Guides ............................................ 4**1
  461. DOS Registers ......................................................... 4**2
  462. DOS Stacks ............................................................ 4**3
  463. DOS Interrupts ........................................................ 4**4
  464. Interrupt 20h (Terminate) ............................................. 4**5
  465. DOS Services (quick list) ............................................. 4**6
  466. Calling the DOS Services .............................................. 4**7
  467. Version Specific Information .......................................... 4**8
  468. Compatibility Problems With DOS 4.0+ .................................. 4**9
  469. PCjr Cartridge Support ................................................ 4**10
  470. eDOS 4.0 .............................................................. 4**11
  471. DOS Services in Detail ................................................ 4**12
  472.  
  473.  
  474. CHAPTER 5       Interrupts 22h through 0FFh
  475.  
  476. Interrupt 22h   Terminate Address ..................................... 5**1
  477. Interrupt 23h   Ctrl-Break Exit Address ............................... 5**2
  478. Interrupt 24h   Critical Error Handler ................................ 5**3
  479. Interrupt 25h   Absolute Disk Read .................................... 5**4
  480. Interrupt 26h   Absolute Disk Write ................................... 5**5
  481. Interrupt 27h   Terminate And Stay Resident ........................... 5**6
  482. Interrupt 28h   (not documented by Microsoft) ......................... 5**7
  483. Interrupt 29h   (not documented by Microsoft) ......................... 5**8
  484. Interrupt 2Ah   Microsoft Networks - Session Layer Interrupt .......... 5**9
  485. Interrupt 2Bh   Unknown ............................................... 5**10
  486. Interrupt 2Ch   Unknown ............................................... 5**11
  487. Interrupt 2Dh   Unknown ............................................... 5**12
  488. Interrupt 2Eh   Alternate EXEC (DOS 2.0+) ............................. 5**13
  489. Interrupt 2Fh   Multiplex Interrupt ................................... 5**14
  490. Interrupt 30h   FAR jump instruction for CP/M-style calls ............. 5**15
  491. Interrupt 31h   Unknown ............................................... 5**16
  492. Interrupt 32h   Unknown ............................................... 5**17
  493. Interrupt 33h   Used by Microsoft Mouse Driver Function Calls ......... 5**18
  494. Interrupt 34h   Turbo C/Microsoft languages - Floating Point emulation  5**19
  495. Interrupt 35h   Turbo C/Microsoft languages - Floating Point emulation  5**20
  496. Interrupt 36h   Turbo C/Microsoft languages - Floating Point emulation  5**21
  497. Interrupt 37h   Turbo C/Microsoft languages - Floating Point emulation  5**22
  498. Interrupt 38h   Turbo C/Microsoft languages - Floating Point emulation  5**23
  499. Interrupt 39h   Turbo C/Microsoft languages - Floating Point emulation  5**24
  500. Interrupt 3Ah   Turbo C/Microsoft languages - Floating Point emulation  5**25
  501. Interrupt 3Bh   Turbo C/Microsoft languages - Floating Point emulation  5**26
  502. Interrupt 3Ch   Turbo C/Microsoft languages - Floating Point emulation  5**27
  503. Interrupt 3Dh   Turbo C/Microsoft languages - Floating Point emulation  5**28
  504. Interrupt 3Eh   Turbo C/Microsoft languages - Floating Point emulation  5**29
  505. Interrupt 3Fh   Overlay Manager Interrupt (Microsoft LINK.EXE) ........ 5**30
  506. Interrupt 40h   Hard Disk BIOS ........................................ 5**31
  507. Interrupt 41h   Hard Disk Parameters .................................. 5**32
  508. Interrupt 42h   Pointer to screen BIOS entry .......................... 5**33
  509. Interrupt 43h   Pointer to EGA Graphics Character Table ............... 5**34
  510. Interrupt 44h   Pointer to graphics character table ................... 5**35
  511. Interrupt 45h   Reserved by IBM  (not initialized) .................... 5**36
  512. Interrupt 46h   Pointer to second hard disk parameter block ........... 5**37
  513. Interrupt 47h   Reserved by IBM  (not initialized) .................... 5**38
  514. Interrupt 48h   Cordless Keyboard Translation ......................... 5**39
  515. Interrupt 49h   Non-keyboard Scan Code Translation Table Address (PCjr) 5**40
  516. Interrupt 4Ah   Real-Time Clock Alarm (Convertible, PS/2) ............. 5**41
  517. Interrupt 4Bh   Reserved by IBM  (not initialized) .................... 5**42
  518. Interrupt 4Ch   Reserved by IBM  (not initialized) .................... 5**43
  519. Interrupt 4Dh   Reserved by IBM  (not initialized) .................... 5**44
  520. Interrupt 4Eh   Reserved by IBM  (not initialized) .................... 5**45
  521. Interrupt 4Fh   Reserved by IBM  (not initialized) .................... 5**46
  522. Interrupt 50-57 IRQ0-IRQ7 Relocation .................................. 5**47
  523. Interrupt 58h   Reserved by IBM  (not initialized) .................... 5**48
  524. Interrupt 59h   Reserved by IBM  (not initialized) .................... 5**49
  525. Interrupt 5Ah   Reserved by IBM  (not initialized)  ................... 5**50
  526. Interrupt 5Bh   Reserved by IBM  (not initialized) .................... 5**51
  527. Interrupt 5Ah   Cluster Adapter BIOS entry address .................... 5**52
  528. Interrupt 5Bh   Reserved by IBM  (not initialized) .................... 5**53
  529. Interrupt 5Ch   NETBIOS interface entry port, TOPS .................... 5**54
  530. Interrupt 5Dh   Reserved by IBM  (not initialized) .................... 5**55
  531. Interrupt 5Eh   Reserved by IBM  (not initialized) .................... 5**56
  532. Interrupt 5Fh   Reserved by IBM  (not initialized) .................... 5**57
  533. Interrupt 60h-67h  User Program Interrupts ............................ 5**58
  534. Interrupt 60h   Network OS Interface .................................. 5**59
  535. Interrupt 67h   Expanded Memory Board Driver Interrupt ................ 5**60
  536. Interrupt 68h   Not Used  (not initialized) ........................... 5**61
  537. Interrupt 69h   Not Used  (not initialized) ........................... 5**62
  538. Interrupt 6Ah   Not Used  (not initialized) ........................... 5**63
  539. Interrupt 6Bh   Not Used  (not initialized) ........................... 5**64
  540. Interrupt 6Ch   System Resume Vector (Convertible) .................... 5**65
  541. Interrupt 6Dh   Not Used  (not initialized) ........................... 5**66
  542. Interrupt 6Eh   Not Used  (not initialized) ........................... 5**67
  543. Interrupt 6Fh   10-Net API............................................. 5**68
  544. Interrupt 70h   IRQ 8, Real Time Clock Interrupt (AT, XT/286, PS/2) ... 5**69
  545. Interrupt 71h   IRQ 9, Redirected to IRQ 8 (AT, XT/286, PS/2) ......... 5**70
  546. Interrupt 72h   IRQ 10  (AT, XT/286, PS/2)  Reserved .................. 5**71
  547. Interrupt 73h   IRQ 11  (AT, XT/286, PS/2)  Reserved .................. 5**72
  548. Interrupt 74h   IRQ 12  Mouse Interrupt (PS/2) ........................ 5**73
  549. Interrupt 75h   IRQ 13, Coprocessor Error (AT) ........................ 5**74
  550. Interrupt 76h   IRQ 14, Hard Disk Controller (AT, XT/286, PS/2) ....... 5**75
  551. Interrupt 77h   IRQ 15 (AT, XT/286, PS/2)  Reserved ................... 5**76
  552. Interrupt 78h   Not Used .............................................. 5**77
  553. Interrupt 79h   Not Used .............................................. 5**78
  554. Interrupt 7Ah   Reserved .............................................. 5**79
  555. Interrupt 7Bh-7Eh  Not Used by IBM .................................... 5**80
  556. Interrupt 7Ch   REXX-PC API ........................................... 5**81
  557. Interrupt 7Fh   IBM 8514/A Graphics Adapter API ....................... 5**82
  558. Interrupt 80h-85h  Reserved by BASIC .................................. 5**83
  559. Interrupt 86h   Int 18 when relocated by NETBIOS ...................... 5**84
  560. Interrupt 86h-0F0h  Used by BASIC when BASIC interpreter is running ... 5**85
  561. Interrupt 0A4h  Right Hand Man API .................................... 5**86
  562. Interrupt 0D4h  PC-MOS/386 API ........................................ 5**87
  563. Interrupt 0E0h  Digital Research CP/M-86 function calls ............... 5**88
  564. Interrupt 0E1h  PC Cluster Disk Server Information .................... 5**89
  565. Interrupt 0E2h  PC Cluster Program .................................... 5**90
  566. Interrupt 0E4h  Logitech Modula-2 v2.0   Monitor Entry ................ 5**91
  567. Interrupt 0E5h  Not Used .............................................. 5**92
  568. Interrupt 0E6h  Not Used .............................................. 5**93
  569. Interrupt 0E7h  Not Used .............................................. 5**94
  570. Interrupt 0E8h  Not Used .............................................. 5**95
  571. Interrupt 0E9h  Not Used .............................................. 5**96
  572. Interrupt 0EAh  Not Used .............................................. 5**97
  573. Interrupt 0EBh  Not Used .............................................. 5**98
  574. Interrupt 0ECh  Not Used .............................................. 5**99
  575. Interrupt 0EDh  Not Used ............................................. 5**100
  576. Interrupt 0EEh  Not Used ............................................. 5**101
  577. Interrupt 0EFh  GEM interface (Digital Research) ..................... 5**102
  578. Interrupt 0F0h  unknown .............................................. 5**103
  579. Interrupts 0F1h-0FFh  (absolute addresses 3C4h-3FFh) ................. 5**104
  580. Interrupt 0F4h  Not Used ............ ................................ 5**105
  581. Interrupt 0F5h  Not Used ............ ................................ 5**106
  582. Interrupt 0F8h  Set Shell Interrupt (OEM) ............................ 5**107
  583. Interrupt 0F9h  Reserved ............................................. 5**108
  584. Interrupt 0FAh  USART ready (RS-232C) ................................ 5**109
  585. Interrupt 0FBh  USART RS ready (keyboard) ............................ 5**110
  586. Interrupt 0FCh  Unknown ...............................................5**111
  587. Interrupt 0FDh  reserved for user interrupt .......................... 5**112
  588. Interrupt 0FEh  reserved by IBM ...................................... 5**113
  589. Interrupt 0FFh  reserved by IBM ...................................... 5**114
  590.  
  591.  
  592.  
  593. CHAPTER 6       DOS Control Blocks and Work Areas
  594.  
  595. DOS Address Space ..................................................... 6**1
  596. Storage Blocks ........................................................ 6**2
  597. Disk Transfer Area (DTA) .............................................. 6**3
  598. Program Segment Prefix ................................................ 6**4
  599. Memory Control Blocks ................................................. 6**5
  600. DOS Program Segment ................................................... 6**6
  601.  
  602.  
  603. CHAPTER 7       DOS File Information
  604.  
  605. File Management Functions ............................................. 7**1
  606. FCB Function Calls .................................................... 7**2
  607. Handle Function Calls ................................................. 7**3
  608. Special File Handles .................................................. 7**4
  609. Raw and Cooked File I/O ............................................... 7**5
  610. Number of Open Files Allowed  ......................................... 7**6
  611. Restrictions on FCB Usage ............................................. 7**7
  612. Restrictions on Handle usage .......................................... 7**8
  613. Allocating Space to a File ............................................ 7**9
  614. MSDOS / PCDOS Differences ............................................. 7**10
  615. .COM File Structure ................................................... 7**11
  616. .EXE File Structure ................................................... 7**12
  617. The Relocation Table .................................................. 7**13
  618. "NEW" .EXE Format (Microsoft Windows and OS/2) ........................ 7**14
  619. Standard File Control Block ........................................... 7**15
  620. Extended File Control Block ........................................... 7**16
  621. Disk Transfer Area .................................................... 7**17
  622.  
  623.  
  624. CHAPTER 8       DOS Disk Information
  625.  
  626. The DOS Area .......................................................... 8**1
  627. The Boot Record ....................................................... 8**2
  628. DOS File Allocation Table (FAT) ....................................... 8**3
  629.         Media Descriptor Byte ......................................... 8**4
  630.         12 Bit FATs ................................................... 8**5
  631.         16 Bit FATs ................................................... 8**6
  632.         32 Bit FATs ................................................... 8**7
  633. DOS Disk Directory .................................................... 8**8
  634. The Data Area ......................................................... 8**9
  635. Floppy Disk Types ..................................................... 8**10
  636. Hard Disk Layout ...................................................... 8**11
  637. System Initialization ................................................. 8**12
  638. Boot Record/Partition Table ........................................... 8**13
  639. Hard Disk Technical Information ....................................... 8**14
  640. Determining Hard Disk File Allocation ................................. 8**15
  641. BIOS Disk Functions ................................................... 8**16
  642.  
  643.  
  644. CHAPTER 9       Device Drivers
  645.  
  646.  
  647. CHAPTER 10      Lotus/Intel/Microsoft Expanded Memory Specification
  648.  
  649. History ............................................................... 10**1
  650. Uses of Expanded Memory ............................................... 10**2
  651. DOS and Expanded Memory ............................................... 10**3
  652. Different Memory Types ................................................ 10**4
  653. AST/Quadram/Ashton-Tate Enhanced EMM .................................. 10**5
  654. EMS Address Space Map ................................................. 10**6
  655. Writing Programs That Use Expanded Memory ............................. 10**7
  656. Page Frames ........................................................... 10**8
  657. Calling the Manager ................................................... 10**9
  658. Detecting EMS ......................................................... 10**10
  659. Terminate and Stay Resident (TSR) Program Cooperation ................. 10**11
  660. Expanded Memory Services Quick List ................................... 10**12
  661. Expanded Memory Services .............................................. 10**13
  662.         LIM 3.2 Specification ......................................... 10**14
  663.         LIM 4.0 Specification ......................................... 10**15
  664.         AQA EEMS 3.2 Specification .................................... 10**16
  665.         VCPI API 1.0 .................................................. 10**17
  666. Expanded Memory Manager Error Codes ................................... 10**18
  667. Microsoft Extended Memory Specification 2.0 ........................... 10**19
  668.  
  669.  
  670. CHAPTER 11      Conversion Between Operating Systems
  671.  
  672. Overview .............................................................. 11**1
  673. Special Considerations ................................................ 11**2
  674. Example Operating Systems ............................................. 11**3
  675. Atari ST .............................................................. 11**4
  676. CP/M .................................................................. 11**5
  677. MacOS ................................................................. 11**6
  678. AmigaDOS .............................................................. 11**7
  679. OS/2 .................................................................. 11**8
  680. UNIX .................................................................. 11**9
  681.  
  682.  
  683. CHAPTER 13      Network APIs
  684.  
  685. FTP Driver - PC/TCP Packet Driver Specification ....................... 13**1
  686. 10-Net Network ........................................................ 13**2
  687. LANtastic LANOS API ................................................... 13**3
  688. Novell NetWare 2.11 API ............................................... 13**4
  689. APPC/PC ............................................................... 13**5
  690.  
  691.  
  692. CHAPTER 14      Mouse Programming
  693.  
  694. General Information ................................................... 14**1
  695. Register Usage ........................................................ 14**2
  696. Interrupt 33h Function Requests ....................................... 14**3
  697. Interrupt 10h Function Requests ....................................... 14**4
  698.  
  699.  
  700. CHAPTER 15      Register-Level Programming
  701.  
  702. 8555 Peripheral Interface ............................................. 15**1
  703. 8259 Interrupt Controller ............................................. 15**2
  704. AT CMOS RAM Configuration ............................................. 15**3
  705.  
  706.  
  707. CHAPTER 16      Video Programming
  708.  
  709. Quick List of BIOS Interrupt 10h Functions ............................ 16**1
  710. BIOS Interrupt 10h Functions in Detail ................................ 16**2
  711.  
  712.  
  713. CHAPTER 17      Multitasking Shells
  714.  
  715. Introduction .......................................................... 17**1
  716. Programming Practices ................................................. 17**2
  717. TopView/DESQview API (interrupt 15h, "System Services" interface) ..... 17**3
  718. TopView/DESQview API (interrupt 16h, "BIOS Video" interface) .......... 17**4
  719.  
  720.  
  721. CHAPTER 18      Viruses and Trojan Horses
  722.  
  723.  
  724. MISCSTUF        Miscellaneous Stuff
  725.  
  726. AFTERWRD        Afterword
  727.  
  728. CREDITS         Credits and Bibliography
  729.  
  730.  
  731.  
  732.  A P P E N D I C E S
  733.  
  734. APPENDIX  1     Keyboard scan code chart
  735.  
  736. APPENDIX  2     ASCII character chart
  737.  
  738. APPENDIX  3     IBM PC character set
  739.  
  740. APPENDIX  4     IBM PC error code listing
  741.  
  742. APPENDIX  5     Addresses of various manufacturers
  743.  
  744. APPENDIX  6     Hard disk information
  745.  
  746. APPENDIX  7     Floppy and Tape Devices
  747.  
  748. APPENDIX  8     Pinouts of various connectors on the IBM PC
  749.  
  750. APPENDIX  9     Sizes of various drivers installed in CONFIG.SYS
  751.  
  752. APPENDIX  10    Common modem instruction sets
  753.  
  754. APPENDIX  11    Glossary of computer terminology
  755.  
  756. APPENDIX  12    Various busses used in MSDOS machines
  757.  
  758. APPENDIX  13    Common filename extensions
  759.  
  760. APPENDIX  14    Clock speeds of various expansion cards
  761.  
  762. APPENDIX  15    Header formats used by various archive utilities
  763.  
  764. APPENDIX  16    Miscellaneous Hardware Information
  765.  
  766. APPENDIX  17    HP LaserJet Setup Codes
  767.  
  768. APPENDIX  18    ANSI.SYS Escape Sequences
  769.  
  770. APPENDIX  19    DEC VT100 Escape Sequences
  771.  
  772. APPENDIX  20    Various Paint Program Formats
  773.  
  774. APPENDIX  21    Some Commonly Used Hot-Keys
  775.  
  776. APPENDIX  22    Sound Blaster API
  777.  
  778. APPENDIX  23    French-Canadian accented character chart
  779.  
  780. APPENDIX  24    Compuserve Graphic Image Format '89a
  781.  
  782. APPENDIX  25    Hex Chart
  783.  
  784. APPENDIX  26    Microsoft TSR Specification 1.0
  785.  
  786.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  787.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  788. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  789.                      ISBN 1-878830-02-3 (disk-based text)
  790.                     Copyright (c) 1987, 1992 Dave Williams
  791.                         ┌─────────────────────────────┐
  792.                         │ Shareware Version, 03/16/92 │
  793.                         │  Please Register Your Copy  │
  794.                         └─────────────────────────────┘
  795.  
  796.  
  797.                             C H A P T E R    O N E
  798.  
  799.                               DOS AND THE IBM PC
  800.  
  801.  
  802.                                 C O N T E N T S
  803.  
  804. Some History .......................................................... 1**1
  805. What is DOS? .......................................................... 1**2
  806. Other Operating Systems ............................................... 1**3
  807. Specific Versions of MS/PC-DOS ........................................ 1**4
  808. The Operating System Heirarchy ........................................ 1**5
  809. DOS Structure ......................................................... 1**6
  810. DOS Initialization .................................................... 1**7
  811.  
  812.  
  813.  
  814. SOME HISTORY├────────────────────────────────────────────────────────── 1**1
  815.  
  816.  Development of MSDOS/PCDOS began in October 1980, when IBM began searching
  817. the market for an operating system for the yet-to-be-introduced IBM PC.
  818. Microsoft had no 8086 real operating system to sell, but quickly made a deal
  819. to license Seattle Computer Products' 86-DOS operating system, which had been
  820. written by Tim Paterson earlier in 1980 for use on that company's line of 8086,
  821. S100 bus micros. 86-DOS (also called QDOS, for Quick and Dirty Operating System)
  822. had been written as more or less a 16-bit version of CP/M, since Digital
  823. Research was showing no hurry in introducing CP/M-86.
  824.  
  825.  This code was quickly polished up and presented to IBM for evaluation. IBM
  826. had originally intended to use Digital Research's CP/M operating system, which
  827. was the industry standard at the time.
  828.  
  829.  Folklore reports various stories about the rift between DRI and IBM. The most
  830. popular story claims Gary Kildall or DRI snubbed the IBM executives by flying
  831. his airplane when the meeting was scheduled. Another story claims Kildall
  832. didn't want to release the source for CP/M to IBM, which would be odd, since
  833. they released it to other companies. One noted industry pundit claims
  834. Kildall's wife killed the deal by insisting on various contract changes. I
  835. suspect the deal was killed by the good ol'boy network. It's hard to imagine
  836. a couple of junior IBM executives giving up when ordered to a task as simple
  837. as licensing an operating system from a vendor. Wouldn't look good on their
  838. performance reports. It would be interesting to hear IBM's story...
  839.  
  840.  IBM found itself left with Microsoft's offering of "Microsoft Disk
  841. Operating System 1.0". An agreement was reached between the two, and IBM agreed
  842. to accept 86-DOS as the main operating system for thir new PC. Microsoft
  843. purchased all rights to 86-DOS in July 1981, and "IBM Personal Computer DOS
  844. 1.0" was ready for the introduction of the IBM PC in October 1981. IBM
  845. subjected the operating system to an extensive quality-assurance program,
  846. reportedly found well over 300 bugs, and decided to rewrite the programs. This
  847. is why PC-DOS is copyrighted by both IBM and Microsoft.
  848.  
  849.  Some early OEM versions of DOS had different names, such as Compaq-DOS, Z-DOS,
  850. Software Bus 86, etc.  By version 2 Microsoft managed to persuade everyone but
  851. IBM to refer to the product as "MS-DOS."
  852.  
  853.  It is sometimes amusing to reflect on the fact that the IBM PC was not
  854. originally intended to run MSDOS. The target operating system at the end of the
  855. development was for a (not yet in existence) 8086 version of CP/M. On the other
  856. hand, when DOS was originally written the IBM PC did not yet exist! Although
  857. PC-DOS was bundled with the computer, Digital Research's CP/M-86 would probably
  858. have been the main operating system for the PC except for two things - Digital
  859. Research wanted $495 for CP/M-86 (considering PC-DOS was essentially free) and
  860. many software developers found it easier to port existing CP/M software to DOS
  861. than to the new version of CP/M.
  862.  
  863.  The upgrade from DOS 3.3 to 4.0 was done in-house by IBM.  DOS 4.0 was a
  864. completely IBM product, later licensed back to Microsoft. In early 1990 IBM
  865. announced that it was ceasing development of DOS and all further work would
  866. be done solely by Microsoft.
  867.  
  868.  
  869.  Microsoft Press' "MSDOS Encyclopedia" shows a reproduction of a late
  870. DOS 1.25 OEM brochure.  Microsoft was touting future enhancements to
  871. 1.25 including Xenix-compatible pipes, process forks, and multitasking,
  872. as well as "graphics and cursor positioning, kanji support, multi-user
  873. and hard disk support, and networking."  Microsoft certainly thought
  874. big, but, alas, the forks, multitasking, and multiuser support never
  875. came about, at least in US versions of DOS.  Oddly, the flyer claims
  876. that
  877.  
  878.  "MS-DOS has no practical limit on disk size. MS-DOS uses 4-byte XENIX
  879. OS compatible pointers for file and disk capacity up to 4 gigabytes."
  880.  
  881.  Umm... yeah.  One sort of gets the idea nobody at Microsoft had a hard
  882. disk larger than 32 megabytes...
  883.  
  884.  For the record they actually delivered:
  885.  
  886. Xenix-compatible pipes             DOS 2.0  ("|" operator)
  887. process forks, and multitasking   eDOS 4.0  (not delivered in the US)
  888. multi-user                         never delivered
  889. graphics and cursor positioning    DOS 2.0  (ANSI.SYS, more than likely)
  890. kanji support                      DOS 2.01, 2.25 (double-byte char set)
  891. hard disk support                  DOS 2.0  (subdirectories)
  892. networking                         DOS 3.1  (file locking, MS Networks)
  893.  
  894.  Early Microsoft ads pumped DOS' Xenix-like features and promised Xenix
  895. functionality in future releases.
  896.  
  897.  We'll probably never know what the real story was behind eDOS/DOS 4/
  898. DOS 5/286DOS/OS2.  Microsoft had announced their intent to build a
  899. multitasking, multiuser version of MSDOS as early as 1982.  They shipped
  900. betas of "DOS 4.0" in '86 and early '87, before 3.3 was even announced.
  901. Microsoft UK announced they had licensed 4.0 to Apricot Computer, and
  902. the French Postal Service was supposed to be running it.  I've never
  903. been able to find out if Apricot ever shipped any 4.0 to end users.
  904.  
  905.  Despite Gordon Letwin's acid comments about problems with the 80286
  906. processor, I doubt the '286 was the barrier between users and a
  907. multitasking MSDOS.  I also doubt there was any shortage of programming
  908. talent at Microsoft - Digital Research's Concurrent DOS and Software
  909. Link's PC-MOS were developed without undue trouble.
  910.  
  911.  
  912.  MSDOS and PC-DOS have been run on more than just the IBM-PC and clones. Some
  913. of the following have been done:
  914.  
  915.  Hardware PC Emulation:
  916.  
  917.         Apple II                ->      TransPC 8088 board
  918.         Apple MacIntosh         ->      AST 80286 board
  919.         Atari 400/800           ->      Co-Power 88 board
  920.         Atari ST                ->      PC-Ditto II cartridge
  921.         Commodore Amiga 2000    ->      8088 or A2286D 80286 Bridge Board
  922.         IBM PC/RT               ->      80286 AT adapter
  923.         Kaypro 2                ->      Co-Power Plus board
  924.  
  925.  Software PC Emulation:
  926.  
  927.         Apple MacIntosh         ->      SoftPC
  928.         Atari ST                ->      PC-Ditto I
  929.         IBM RS/6000             ->      DOS emulation
  930.  
  931.  DOS Emulation:
  932.  
  933.         AIX (IBM RS/6000)       ->      DOS emulation with "PCSIMulator"
  934.         OS/2                    ->      DOS emulation in "Compatibility Box"
  935.         QNX                     ->      DOS window
  936.         SunOS                   ->      DOS window
  937.         Xenix                   ->      DOS emulation with DOSMerge
  938.  
  939.  
  940. WHAT IS DOS?├────────────────────────────────────────────────────────── 1**2
  941.  
  942.  DOS exists as a high-level interface between an application program and the
  943. computer. DOS stands for "Disk Operating System", which reflects the fact that
  944. its main original purpose was to provide an interface between the computer and
  945. its disk drives.
  946.  
  947.  DOS now lets your programs do simple memory management, I/O from the system
  948. console, and assorted system tasks (time and date, etc) as well as managing
  949. disk operations. Versions 3.1 and up also incorporate basic networking
  950. functions.
  951.  
  952.  With the introduction of installable device drivers and TSR (terminate but
  953. stay resident) programs in DOS 2.0, the basic DOS functions may be expanded to
  954. cover virtually any scale of operations required.
  955.  
  956.  
  957. OTHER OPERATING SYSTEMS├─────────────────────────────────────────────── 1**3
  958.  
  959.  There are a number of compatible replacements for Microsoft's MSDOS. Some are:
  960.  
  961. Alloy 386 Multiware                  (multitasking control prog, licensed DOS)
  962. Consortium Technologies MultiDOS     (multitasking, multiuser)
  963. Digital Research Concurrent DOS      (multitasking)
  964. Digital Research Concurrent DOS 386  (for 80386 computers)
  965. Digital Research Concurrent DOS XM   (multitasking, multiuser)
  966. Digital Research DR-DOS 3.31 and 5.0 (PC-DOS clones)
  967. Digital Research Multiuser DOS       (multitasking, multiuser)
  968. PC-MOS/386                           (multitasking, multiuser)
  969. Wendin-DOS                           (multitasking, multiuser)
  970. VM/386                               (multitasking)
  971.  
  972.  Various other operating systems are available for the IBM PC. These include:
  973.  
  974. Digital Research CP/M-86
  975. Digital Research Concurrent CP/M-86 (multitasking)
  976. Minix (multitasking UNIX workalike)
  977. Pick  (database-operating system)
  978. QNX   (multitasking, multiuser)
  979. UNIX  (various systems from IBM itself, Microsoft-SCO, Bell, and various UNIX
  980.        clones, single and multi user) (AIX, Xenix, AT&T System V, etc.)
  981.  
  982.  "Shell" programs exist which use DOS only for disk management while they more
  983. or less comprise a new operating system. These include:
  984.  
  985.      DesQview                        Windows                     OmniView
  986.      GEM                             TopView                     TaskView
  987.      GeoWorks
  988.  
  989.  Systems using the NEC V-series CPUs can execute Intel 8080/8085 8-bit
  990. instructions as well as the 16-bit 8088-up instructions.  They can run standard
  991. Digital Research 8-bit CP/M and MP/M directly, as well as other operating
  992. systems developed for that processor.
  993.  
  994.  
  995.  
  996. SPECIFIC VERSIONS OF MS/PC-DOS├──────────────────────────────────────── 1**4
  997.  
  998.  DOS 1.x is essentially 86-DOS.  DOS 2.x kept the multiple file layout (the two
  999. hidden files and COMMAND.COM) but for all practical purposes is an entirely
  1000. different operating system with backwards compatibility with 1.x.  I seriously
  1001. doubt there has been much code from 1.x retained in 2.x. DOS 3.x is merely an
  1002. enhancement of 2.x; there seems little justification for jumping a whole
  1003. version number.  The disk handling routines were considerably extended in 3.1,
  1004. allowing disk access in a "virtual" fashion, independent of whether the drive
  1005. was a local or network device.  DOS 4.0, originating as it did from outside
  1006. Microsoft, can justify a version jump.  Unfortunately, 4.0 seemed to have very
  1007. little reason to justify its existence - virtually all of its core features
  1008. could be found in one version or another of DOS 3.x.  According to Microsoft's
  1009. Gordon Letwin, DOS 5.0 was a complete rewrite with the kernel done in hand
  1010. optimized assembly language.
  1011.  
  1012.  DOS version nomenclature: major.minor.minor.  The digit to the left of the
  1013. decimal point indicates a major DOS version change.  1.0 was the first version.
  1014. 2.0 added support for subdirectories, 3.0 added support for networking, 4.0
  1015. added some minimal support for Lotus-Intel-Microsoft EMS.
  1016.  
  1017.  The first minor version indicates customization for a major application.  For
  1018. example, 2.1 for the PCjr, 3.3 for the PS/2s.  The second minor version does not
  1019. seem to have any particular meaning.
  1020.  
  1021.  The main versions of DOS are:
  1022.  
  1023.  86-DOS       February 1981  Paterson's Quick'n'Dirty DOS first runs on PC
  1024.  PC-DOS 1.0   August   1981  original IBM release
  1025.  PC-DOS 1.05  -------- ----  fixes to BASIC interpreter
  1026.  PC-DOS 1.1   June     1982  bugfix, double sided drive support
  1027.  MS-DOS 1.25  July     1982  for early compatibles. This is the first non-IBM
  1028.                              OEM version
  1029.  PC-DOS 2.0   March    1983  for PC/XT, Unix-type subdirectory support,
  1030.                              installable device drivers, I/O redirection,
  1031.                              subdirectories, hard disk support, handle calls
  1032.  PC-DOS 1.85  April    1983  internal IBM - extended 1.1 - not released
  1033.  MS-DOS 2.01  -------- 1983  first support for individual country formats, Kanji
  1034.  PC-DOS 2.1   October  1983  for IBM PCjr, bugfixes for 2.0. No country support
  1035.  MS-DOS 2.11  October  1983  basically a cross of PC-DOS 2.1 and MS-DOS 2.01
  1036.  MS-DOS 2.12  -------- ----  special version for TI Professional
  1037.  PC-DOS 3.0   August   1984  1.2 meg drive for PC/AT, some new system calls,
  1038.                              new external programs, 16-bit FAT, specific support
  1039.                              for IBM network
  1040.  MS-DOS 3.05  -------- 1984  first OEM version of 3.x
  1041.  PC-DOS 3.1   November 1984  bugfix for 3.0, implemented generic network support
  1042.  MS-DOS 2.25  October  1985  extended foreign language support
  1043.  PC-DOS 3.2   January  1986  720k 3.5 inch drive support, special support for
  1044.                              laptops (IBM PC Convertible), XCOPY
  1045.  MS-DOS 4.0   April    1986  multitasking (Europe only) - withdrawn from market
  1046.  PC-DOS 3.3   April    1987  for PS/2 series, 1.44 meg support, multiple DOS
  1047.                              partition support, code page switching, improved
  1048.                              foreign language support, some new function calls,
  1049.                              support for the AT's CMOS clock.
  1050.  MS-DOS 3.31  November 1987  over-32 meg DOS partitions. Different versions
  1051.                              from different OEMs (not Microsoft).  Compaq and
  1052.                              Wyse are most common.
  1053.  PC-DOS 3.4   -------- ----  internal IBM - not released (4.0 development)
  1054.  MS-DOS 2.11R -------- 1988  bootable ROM DOS for Tandy machines
  1055.  PC-DOS 4.0   August   1988  32mb limit officially broken, minor EMS support,
  1056.                              more new function calls, enhanced network support
  1057.                              for external commands
  1058.  MS-DOS 4.01  January? 1989  Microsoft version with some bugfixes
  1059.  MS-DOS 3.21R September1989  DOS in ROM, Flash File System for laptops
  1060.  MS-DOS 3.3R  -------- 1990  DOS in ROM, introduced for TI laptops
  1061.  MS-DOS 5.0   June     1991  new high memory support, uses up to 8 hard disks,
  1062.                              command line editor and aliasing, 2.88 floppies
  1063.  
  1064.  IBM's PC-DOS was long considered to be the "standard" version of DOS.  Now
  1065. that MS 5.0 is a commercial product most developers will probably write to it.
  1066.  
  1067.  Microsoft's policy has been to sell DOS only to OEMs.  Despite this, they
  1068. sold small quantities of DOS 3.2, 3.3, and 4.0 without insurmountable
  1069. difficulties.  DOS 5.0 was conceived from the beginning as an over-the-counter
  1070. retail product.
  1071.  
  1072.  Incidentally, IBM refers to its DOS as "The IBM Personal Computer DOS." The
  1073. term "PCDOS" is a trademark of IBM's rival DEC.
  1074.  
  1075.  Some versions of MS-DOS varied from PC-DOS in the available external commands.
  1076. Some OEMs only licensed the basic operating system code (the xxxDOS and xxxBIO
  1077. programs, and COMMAND.COM) from Microsoft, and either wrote the rest themselves
  1078. or contracted them from outside software houses like Phoenix.  Most of the
  1079. external programs for DOS 3.x and 4.x are written in "C" while the 1.x and 2.x
  1080. utilities were written in assembly language.  Other OEMs required customized
  1081. versions of DOS for their specific hardware configurations, such as Sanyo 55x
  1082. and early Tandy computers, which were unable to exchange their DOS with the IBM
  1083. version.
  1084.  
  1085.  PC-DOS 3.0 was extremely buggy on release.  It did not handle the DOS
  1086. environment correctly and there were numerous documented problems with the
  1087. batch file parser.  The network support code was also nonfunctional in that DOS
  1088. version.  It is recommended that users upgrade to at least version 3.1.
  1089.  
  1090.  DEC MSDOS versions 2.11 for the Rainbow had the ANSI.SYS device driver built
  1091. into the main code.  The Rainbow also used a unique quad density, single-sided
  1092. floppy drive and its DOS had special support for it.
  1093.  
  1094.  IBM had a version 1.85 of PC-DOS in April 1983, after the introduction of DOS
  1095. 2.0.  It was evidently for internal use only, supported multiple drive file
  1096. searches (a primitive form of PATH), builtin MODE sommands for screen support,
  1097. a /P parameter for TYPE for paused screens, an editable command stack like the
  1098. public domain DOSEDIT.COM utility, and could be set up to remain completely
  1099. resident in RAM instead of a resident/transient part like normal DOS.  It is a
  1100. pity some of the neat enhancements didn't make it into DOS 2.0.  IBM also had
  1101. an "internal use only" version 3.4, evidently used while developing DOS 4.0.
  1102.  
  1103.  Digital Research's DR-DOS is the first widely available DOS clone.  Version
  1104. 3.4, released in June 1988, was the one first available to the American public.
  1105. It was somewhat buggy and its use is not recommended.  DR 3.41 is extremely
  1106. compatible and its use should pose no problems on any machine.  DR-DOS 5.0
  1107. (released May, 1990) is functionally equivalent to MS-DOS 5.0.  For all
  1108. practical purposes, MS 5.0 is a clone of DR 5.0, since DR beat MS to market by
  1109. over a year.  According to Greg Ewald, DRI's DR-DOS product manager, DR-DOS was
  1110. developed from Concurrent DOS 386 with the multiuser and multitasking code
  1111. stripped out.
  1112.  
  1113.  Some versions of DOS used in compatibles do not maintain the 1.x, 2.x, ...
  1114. numbering system.  Columbia Data Products computers labeled DOS 1.25 as DOS
  1115. 2.0.  Early Compaqs labeled DOS 2.0 as DOS 1.x.  Other versions incorporated
  1116. special features - Compaq DOS 3.31 and Wyse DOS 3.21 both support >32mb disk
  1117. partitions in the same fashion as DOS 4.x.
  1118.  
  1119.  AT&T DOS 3.1 differs from generic MSDOS 3.10 in its use of cluster-size and
  1120. file allocation table structures.  AT&T DOS appears to use rules not from
  1121. version 3, but rather those from version 2.
  1122.  
  1123.  Epson Equity III and ComputerLand 3.10 DOS's appear to use cluster techniques
  1124. that are a cross between versions 2 and 3.  On type DOS partitions, these DOS's
  1125. use 3.x rules if the partition is larger than 32,680 sectors in total size.
  1126. This implies 16 bit FAT entries as well.  On partitions below this size, they
  1127. will use 2.x rules, including the 12 bit FAT entries.
  1128.  
  1129.  Zenith DOS 3.x and Wyse DOS 3.2 have a builtin internal device driver to
  1130. handle up to 4 32Mb DOS partitions on a single hard disk. Wyse DOS 3.31 will
  1131. handle single partitions up to 512Mb with a 32-bit FAT.
  1132.  
  1133.  According to PC Week Magazine, July 4, 1988, Arabic versions of MSDOS are
  1134. shipping with a hardware copy-protection system from Rainbow Technologies.
  1135. This is similar to the short-lived system used by AutoCAD 2.52 and a very few
  1136. other MSDOS programs, where an adapter block is plugged into the parallel port
  1137. and software makes use of coded bytes within the block.  This type of copy
  1138. protection has been common on Commodore products for several years, where it is
  1139. called a "dongle."
  1140.  The AutoCAD dongle was defeated by a small program written within weeks of
  1141. version 2.52's debut.  Version 2.62 was released 3 months later, without the
  1142. dongle.  The DOS dongle will, however, prevent the system from booting at all
  1143. unless it is found.
  1144.  This makes the Arabic version of MSDOS the first copy-protected operating
  1145. system, a dubious distinction at best.  The modifications to the operating
  1146. system to support the dongle are not known at this time.  Frankly, it would
  1147. seem that burning the operating system into ROMs would be cheaper and simpler.
  1148.  
  1149.  Versions of DOS sold in Great Britain are either newer than those sold in the
  1150. US or use a different numbering system.  DOS 3.4, 4.0, 4.1, 4.2, and 4.3 had
  1151. been released there between the US releases of 3.3 and 4.0.
  1152.  MSDOS 4.0 (eDOS) was introduced in mid-1987 in Europe (at SICOB in Paris and
  1153. sometime earlier by Apricot Computer in the UK).  It offered multitasking
  1154. provided applications were specially written for it.
  1155.  David Fraser (Microsoft UK Managing Director) is on record saying that "DOS
  1156. 4.0 is unlikely to set the world alight and is of interest only to specific
  1157. OEMs who want its features for networking and communications."   Standard DOS
  1158. applications will run under DOS 4.x as a foreground task according to uncertain
  1159. information.  It differs from earlier versions only in allowing background tasks
  1160. to run.  For further information, see Chapter 4.
  1161.  
  1162.  Microsoft changed their OEM licensing agreements between DOS versions 2.x and
  1163. 3.x.  OEM versions of DOS 3.x must maintain certain data areas and undocumented
  1164. functions in order to provide compatibility with the networking features of the
  1165. operating system.  For this reason, TSR programs will be much more reliable
  1166. when operating under DOS 3.x.
  1167.  
  1168.  Several versions of DOS have been modified to be run out of ROM.  The Sharp
  1169. PC5000 had MSDOS 1.25 in ROM, and the Toshiba 1000 and some Tandy 1000 models
  1170. have MSDOS 2.11 in ROM.  In mid September 1989 Microsoft introduced 3.21R ROMs
  1171. for laptops, and in early '90 Texas Instruments laptops were the first to get
  1172. the 3.3R ROMs.  Digital Research has also announced its DR-DOS 3.41 and 5.0 is
  1173. available in a ROM version and Award Software is marketing DOS cards to OEMs
  1174. as a plug-in to ISA-bus machines.
  1175.  
  1176.  IBM's release of DOS 4.0 (and the immediate subsequent release of a bugfix)
  1177. was a dubious step "forward."  DOS 4.0 was the first version of DOS to come with
  1178. a warranty; the catch is that IBM warranted it only for a very slim list of
  1179. IBM-packaged software.  4.0 had some minor EMS support, support for large hard
  1180. disks, and not much else.  With its voracious RAM requirements and lack of
  1181. compatibility with previous versions of DOS (many major software packages
  1182. crashed under DOS 4.0), plus the increase in price to a cool $150, there was
  1183. no great rush to go to that version of DOS.
  1184.  
  1185.  Microsoft undertook development of MSDOS 5.0 in early 1990, soliciting
  1186. input from Usenet, BIX, and Compuserve among others.  5.0 is a functional
  1187. clone of Digital Research's DR-DOS 5.0.  5.0's compatibility was assured
  1188. by what has been claimed as the largest beta-test program in history -
  1189. in his address to the Boston Computer Society, Bill Gates announced over
  1190. 7,500 testers were involved.
  1191.  
  1192.  
  1193.  
  1194.  
  1195. THE OPERATING SYSTEM HIERARCHY├──────────────────────────────────────── 1**5
  1196.  
  1197.  
  1198.  The Disk Operating System (DOS) and the ROM BIOS serve as an insulating layer
  1199. between the application program and the machine, and as a source of services
  1200. to the application program.
  1201.  
  1202.   As the term 'system' might imply, DOS is not one program but a collection
  1203. of programs designed to work together to allow the user access to programs
  1204. and data.  Thus, DOS consists of several layers of "control"programs and a set
  1205. of "utility" programs.
  1206.  
  1207.  The system hierarchy may be thought of as a tree, with the lowest level being
  1208. the actual hardware.  The 8088 or V20 processor sees the computer's address
  1209. space as a ladder one byte wide and one million bytes long.  Parts of this
  1210. ladder are in ROM, parts in RAM, and parts are not assigned.  There are also
  1211. 65,536 "ports" that the processor can use to control devices.
  1212.  
  1213.  The hardware is normally addressed by the ROM BIOS, which will always know
  1214. where everything is in its particular system.  The chips may usually also be
  1215. written to directly, by telling the processor to write to a specific address or
  1216. port.  This sometimes does not work as the chips may not always be at the same
  1217. addresses or have the same functions from machine to machine.
  1218.  
  1219.  
  1220.  
  1221. DOS STRUCTURE├───────────────────────────────────────────────────────── 1**6
  1222.  
  1223. DOS consists of four components:
  1224.  
  1225.  * The boot record
  1226.  * The ROM BIOS interface  (IBMBIO.COM, DRBIOS.SYS, or IO.SYS)
  1227.  * The DOS program file    (IBMDOS.COM, DRBDOS.SYS, or MSDOS.SYS)
  1228.  * The command processor   (COMMAND.COM or aftermarket replacement)
  1229.  
  1230.  
  1231. * The Boot Record
  1232.  
  1233.  The boot record begins on track 0, sector 1, side 0 of every diskette prepared
  1234. by the DOS FORMAT command.  The boot record is placed on diskettes to produce an
  1235. error message if you try to start up the system with a nonsystem diskette in
  1236. drive A.  For hard disks, the boot record resides on the first sector of the DOS
  1237. partition.  All media supported by DOS use one sector for the boot record.
  1238.  
  1239.  
  1240. * Read Only Memory (ROM) BIOS Interface and Extensions
  1241.  
  1242.  The file IBMBIO.COM or IO.SYS is the interface module to the ROM BIOS.
  1243. This file provides a low-level interface to the ROM BIOS device routines and
  1244. may contain extensions or changes to the system board ROMs.  Some compatibles do
  1245. not have a ROM BIOS to extend, and load the entire BIOS from disk.  (Sanyo 55x,
  1246. Viasyn machines).  Some versions of MSDOS, such as those from Compaq's MS-DOS
  1247. and Digital Research's DRDOS 5.0, are named IBMBIO.COM but are not IBM files.
  1248.  
  1249.  These low-level interface routines include the instructions for performing
  1250. operations such as displaying information on the screen, reading the keyboard,
  1251. sending data out to the printer, operating the disk drives, and so on.  It is
  1252. the operating system's means of controlling the hardware.  IBMBIO.COM contains
  1253. any modifications or updates to the ROM BIOS that are needed to correct any
  1254. bugs or add support for other types of hardware such as new disk drives.  By
  1255. using IBMBIO.COM to update the ROM BIOS on the fly when the user turns on their
  1256. computer, IBM does not need to replace the ROM BIOS chip itself, but makes any
  1257. corrections through the cheaper and easier method of modifying the IBMBIO.COM
  1258. file instead.
  1259.  
  1260.  IBMBIO.COM also keeps track of hardware operations on an internal stack or
  1261. "scratch pad" area for the operating system to save information such as
  1262. addresses it will need, etc.  An example of the use for this stack can be seen
  1263. when running a program such as a word processor.  If you have told the word
  1264. processor to save your letter, it will write the data to your disk.  During this
  1265. time, if you start typing some more information, the keyboard generates a
  1266. hardware interrupt.  Since you don't want the process of writing the information
  1267. to the disk to be interrupted, DOS allocates a slot in the stack for the
  1268. keyboard's hardware interrupt and when it gets a chance, (probably after the
  1269. data has been written to the disk), it can process that interrupt and pick up
  1270. the characters you may have been typing.  The STACKS= command in DOS 3.2+'s
  1271. CONFIG.SYS file controls the number of stack frames available for this
  1272. purpose.
  1273.  
  1274.  IBMBIO.COM also reads your CONFIG.SYS file and installs any device drivers
  1275. (i.e. DEVICE=ANSI.SYS) or configuration commands it may find there.
  1276.  
  1277.  
  1278.  
  1279. * The DOS Program
  1280.  
  1281.  The actual DOS program is the file IBMDOS.COM or MSDOS.SYS.  It provides a high-
  1282. level interface for user (application) programs.  This program consists of file
  1283. management routines, data blocking/deblocking for the disk routines, and a
  1284. variety of built-in functions easily accessible by user programs.
  1285.  
  1286.  When a user program calls these function routines, they accept high-level
  1287. information by way of register and control block contents.  When a user program
  1288. calls DOS to perform an operation, these functions translate the requirement
  1289. into one or more calls to IBMBIO.COM, MSDOS.SYS or system hardware to complete
  1290. the request.
  1291.  
  1292.  This section is often referred to as the "kernel" by systems programmers.
  1293.  
  1294.  
  1295.  
  1296. * The Command Interpreter
  1297.  
  1298.  The command interpreter, COMMAND.COM, is the part you interact with on the
  1299. command line.  COMMAND.COM has three parts.  IBM calls them the "resident
  1300. portion", the "initialization portion" and the "transient portion".
  1301.  
  1302.  IBM's original documentation spoke of installing alternate command
  1303. interpreters (programs other than COMMAND.COM) with the SHELL= statement in
  1304. CONFIG.SYS.  Unfortunately, IBM chose not to document much of the interaction
  1305. between IBMDOS.COM and IBMBIO.COM.  By the time much of the interaction was
  1306. widely understood, many commercial software programs had been written to use
  1307. peculiarities of COMMAND.COM itself.
  1308.  
  1309.  Several programs exist that perform as actual "shells" by completely replacing
  1310. COMMAND.COM and substituting their own command interpreter to use with the
  1311. hidden DOS files.  Examples are Command Plus, a commercial package, and the
  1312. shareware 4DOS and FlexShell packages.  Both supply greatly enhanced batch
  1313. language and editing capabilities.
  1314.  
  1315. NOTE: DOS 3.3+ checks for the presence of a hard disk, and will default to
  1316.       COMSPEC=C:\.  Previous versions default to COMSPEC=A:\.  Under some DOS
  1317.       versions, if COMMAND.COM is not immediately available for reloading
  1318.       (i.e., swapping to a floppy with COMMAND.COM on it) DOS may crash.
  1319.  
  1320.  
  1321. Resident Portion:
  1322.  
  1323.  The resident portion resides in memory immediately following IBMDOS.COM and its
  1324. data area.  This portion contains routines to process interrupts 22h (Terminate
  1325. Address), 23h (Ctrl-Break Handler), and 24h (Critical Error Handler), as well as
  1326. a routine to reload the transient portion if needed.  For DOS 3.x, this portion
  1327. also contains a routine to load and execute external commands, such as files
  1328. with exensions of COM or EXE.
  1329.  
  1330.  When a program terminates, a checksum is used to determine if the application
  1331. program overlaid the transient portion of COMMAND.COM.  If so, the resident
  1332. portion will reload the transient portion from the area designated by COMSPEC=
  1333. in the DOS environment.  If COMMAND.COM cannot be found, the system will halt.
  1334.  
  1335.  All standard DOS error handling is done within the resident portion of
  1336. COMMAND.COM.  This includes displaying error messages and interpreting the
  1337. replies to the "Abort, Retry, Ignore, Fail?" message.
  1338.  
  1339.  Since the transient portion of COMMAND.COM is so large (containing the
  1340. internal commands and all those error messages), and it is not needed when the
  1341. user is running an application it can be overlaid that program if that
  1342. application needs the room.  When the application is through, the resident
  1343. portion of COMMAND.COM brings the transient portion back into memory to show
  1344. the prompt.  This is why you will sometimes see the message "Insert disk with
  1345. COMMAND.COM".  It needs to get the transient portion off the disk since it was
  1346. overlaid with the application program.
  1347.  
  1348.  The initialization portion of COMMAND.COM follows the resident portion and is
  1349. given control during the bootup procedure.  This section actually processes the
  1350. AUTOEXEC.BAT file.  It also decides where to load the user's programs when they
  1351. are executed.  Since this code is only needed during startup, it is overlaid by
  1352. the first program which COMMAND.COM loads.
  1353.  
  1354.  The transient portion is loaded at the high end of memory and it is the
  1355. command processor itself.  It interprets whatever the user types in at the
  1356. keyboard, hence messages such as "Bad command or file name" for when the user
  1357. misspells a command.  This portion contains all the internal commands (i.e.
  1358. COPY, DIR, RENAME, ERASE), the batch file processor (to run .BAT files) and
  1359. a routine to load and execute external commands which are either .COM or
  1360. .EXE files.
  1361.  
  1362.  The transient portion of COMMAND.COM produces the system prompt, (C>), and
  1363. reads what the user types in from the keyboard and tries to do something with
  1364. it.  For any .COM or .EXE files, it builds a command line and issues an EXEC
  1365. function call to load the program and transfer control to it.
  1366.  
  1367.  
  1368.  
  1369. DOS INITIALIZATION├──────────────────────────────────────────────────── 1**7
  1370.  
  1371.  The system is initialized by a software reset (Ctrl-Alt-Del), a hardware reset
  1372. (reset button), or by turning the computer on.  The Intel 80x8x series processors
  1373. always look for their first instruction at the end of their address space
  1374. (0FFFF0h) when powered up or reset.  This address contains a jump to the first
  1375. instruction for the ROM BIOS.
  1376.  
  1377.  Built-in ROM programs (Power-On Self-Test, or POST, in the IBM) check machine
  1378. status and run inspection programs of various sorts.  Some machines set up a
  1379. reserved RAM area with bytes indicating installed equipment (AT and PCjr).
  1380.  
  1381.  When the ROM BIOS finds a ROM on an adapter card, it lets that ROM take
  1382. control of the system so that it may perform any set up necessary to use the
  1383. hardware or software controlled by that ROM.  The ROM BIOS searches absolute
  1384. addresses C8000h through E0000h in 2K increments in search of a valid ROM.
  1385. A valid ROM is determined by the first few bytes in the ROM.  The ROM will have
  1386. the bytes 55h, AAh, a length indicator and then the assembly language
  1387. instruction to CALL FAR (to bring in a "FAR" routine).  A checksum is done on
  1388. the ROM to verify its integrity, then the BIOS performs the CALL FAR to bring
  1389. in the executible code.  The adapter's ROM then performs its initialization
  1390. tasks and hopefully returns control of the computer back to the ROM BIOS so it
  1391. can continue with the booting process.
  1392.  
  1393.  The ROM BIOS routines then look for a disk drive at A: or an option ROM
  1394. (usually a hard disk) at absolute address C:800h.  If no floppy drive or option
  1395. ROM is found, the BIOS calls int 19h (ROM BASIC if it is an IBM) or displays
  1396. an error message.
  1397.  
  1398.  If a bootable disk is found, the ROM BIOS loads the first sector of information
  1399. from the disk and then jumps into the RAM location holding that code.  This code
  1400. normally is a routine to load the rest of the code off the disk, or to "boot"
  1401. the system.
  1402.  
  1403.  The following actions occur after a system initialization:
  1404.  
  1405.  1.  The boot record is read into memory and given control.
  1406.  
  1407.  2.  The boot record then checks the root directory to assure that the first
  1408.      two files are IBMBIO.COM and IBMDOS.COM or their OEM equivalents.  These
  1409.      must be the first two files, and they must be in that order (IBMBIO.COM
  1410.      first, with its sectors in contiguous order).
  1411.      NOTE: IBMDOS.COM need not be contiguous in version 3.x+.
  1412.  
  1413.  3.  The boot record loads IBMBIO.COM into memory.
  1414.  
  1415.  4.  The initialization code in IBMBIO.COM loads IBMDOS.COM, determines
  1416.      equipment status, resets the disk system, initializes the attached
  1417.      devices, sets the system parameters and loads any installable device
  1418.      drivers according to the CONFIG.SYS file in the root directory (if
  1419.      present), sets the low-numbered interrupt vectors, relocates IBMDOS.COM
  1420.      downward, and calls the first byte of DOS.
  1421.      NOTE: CONFIG.SYS may be a hidden file.
  1422.  
  1423.  5.  DOS initializes its internal working tables, initializes the interrupt
  1424.      vectors for interrupts 20h through 27h, and builds a Program Segment
  1425.      Prefix for COMMAND.COM at the lowest available segment.  For DOS versions
  1426.      3.10 up, DOS also initializes the vectors for interrupts 0Fh through 3Fh.
  1427.      An initialization routine is included in the resident portion and assumes
  1428.      control during startup.  This routine contains the AUTOEXEC.BAT file
  1429.      handler and determines the segment address where user application programs
  1430.      may be loaded.  The initialization routine is then no longer needed and is
  1431.      overlaid by the first program COMMAND.COM loads.
  1432.      NOTE: AUTOEXEC.BAT may be a hidden file.
  1433.  
  1434.  6.  IBMDOS.COM uses the EXEC function call to load and start the top-level
  1435.      command processor.  The default command processor is COMMAND.COM in the
  1436.      root directory of the boot drive.  If COMMAND.COM is in a subdirectory
  1437.      or another command processor is to be used, it must be specified by a
  1438.      SHELL= statement in the CONFIG.SYS file.
  1439.      A transient portion is loaded at the high end of memory.  This is the
  1440.      command processor itself, containing all of the internal command
  1441.      processors and the batch file processor.  For DOS 2.x, this portion also
  1442.      contains a routine to load and execute external commands, such as files
  1443.      with extensions of COM or EXE.
  1444.       This portion of COMMAND.COM also produces the DOS prompt (such as "A>"),
  1445.      reads the command from the standard input device (usually the keyboard or
  1446.      a batch file), and executes the command.  For external commands, it builds
  1447.      a command line and issues an EXEC function call to load and transfer
  1448.      control to the program.
  1449.  
  1450. note 1) COMMAND.COM may be a hidden file.
  1451.      2) For IBM DOS 2.x, the transient portion of the command processor
  1452.         contains the EXEC routine that loads and executes external commands.
  1453.         For MSDOS 2.x+ and IBM DOS 3.x+, the resident portion of the command
  1454.         processor contains the EXEC routine.
  1455.      3) IBMDOS only checks for a file named "COMMAND.COM".  It will load
  1456.         any file of that name if no SHELL= command is used.
  1457.  
  1458.  
  1459.  That pretty much covers the bootup process.  After the command processor is
  1460. loaded, it runs the AUTOEXEC.BAT file and then the user gets their prompt to
  1461. begin working.
  1462.  
  1463.  
  1464.  
  1465.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  1466.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  1467. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  1468.                      ISBN 1-878830-02-3 (disk-based text)
  1469.                     Copyright (c) 1987, 1992 Dave Williams
  1470.                         ┌─────────────────────────────┐
  1471.                         │ Shareware Version, 03/16/92 │
  1472.                         │  Please Register Your Copy  │
  1473.                         └─────────────────────────────┘
  1474.  
  1475.  
  1476.                              C H A P T E R   T W O
  1477.  
  1478.  
  1479.  CPU Port Assignments, System Memory Map, BIOS Data Area, Interrupts 00h to 09h
  1480.  
  1481.  
  1482.  
  1483.                                 C O N T E N T S
  1484.  
  1485. Introduction .......................................................... 2**1
  1486. System Memory Map ..................................................... 2**2
  1487. A Brief Guide to Current Memory Terminology ........................... 2**3
  1488. PC Port Assignment .................................................... 2**4
  1489. Reserved Memory Locations ............................................. 2**5
  1490. Absolute Addresses .................................................... 2**6
  1491. The IBM PC System Interrupts (Overview) ............................... 2**7
  1492. Quick Chart of Interrupts 00h-0FFh .................................... 2**8
  1493. The IBM-PC System Interrupts 00h-0Fh (in detail) ...................... 2**9
  1494.  
  1495.  
  1496.  
  1497. Introduction .......................................................... 2**1
  1498.  
  1499.  For consistency in this reference, all locations and offsets are in
  1500. hexadecimal unless otherwise specified. All hex numbers are prefaced with a
  1501. leading zero if they begin with an alphabetic character, and are terminated
  1502. with a lowercase H (h). The formats vary according to common usage.
  1503.  
  1504.  
  1505.  
  1506. System Memory Map ..................................................... 2**2
  1507.  
  1508.  The IBM PC handles its address space in 64k segments, divided into 16k
  1509. fractions and then further as necessary.
  1510.  
  1511. ┌──────┬─────┬─────┬──────────────────────────────────────────────────────────┐
  1512. │start │start│end  │                                                          │
  1513. │addr. │addr.│addr.│                          usage                           │
  1514. │(dec) │   (hex)   │                                                          │
  1515. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1516. │   *640k RAM Area*                                                           │
  1517. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1518. │ 0k   │           │  start of RAM, first K is interrupt vector table         │
  1519. │ 16k  │00000-03FFF│  PC-0 system board RAM ends                              │
  1520. │ 32k  │04000-07FFF│                                                          │
  1521. │ 48k  │08000-0BFFF│                                                          │
  1522. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1523. │ 64k  │10000-13FFF│  PC-1 system board RAM ends                              │
  1524. │ 80k  │14000-17FFF│                                                          │
  1525. │ 96k  │18000-1BFFF│                                                          │
  1526. │ 112k │1C000-1FFFF│                                                          │
  1527. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1528. │ 128k │20000-23FFF│                                                          │
  1529. │ 144k │24000-27FFF│                                                          │
  1530. │ 160k │28000-2BFFF│                                                          │
  1531. │ 176k │2C000-2FFFF│                                                          │
  1532. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1533. │ 192k │30000-33FFF│                                                          │
  1534. │ 208k │34000-37FFF│                                                          │
  1535. │ 224k │38000-3BFFF│                                                          │
  1536. │ 240k │3C000-3FFFF│                                                          │
  1537. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1538. │ 256k │40000-43FFF│  PC-2 system board RAM ends                              │
  1539. │ 272k │44000-47FFF│                                                          │
  1540. │ 288k │48000-4BFFF│                                                          │
  1541. │ 304k │4C000-4FFFF│                                                          │
  1542. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1543. │ 320k │50000-53FFF│                                                          │
  1544. │ 336k │54000-57FFF│                                                          │
  1545. │ 352k │58000-5BFFF│                                                          │
  1546. │ 368k │5C000-5FFFF│                                                          │
  1547. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1548. │ 384k │60000-63FFF│                                                          │
  1549. │ 400k │64000-67FFF│                                                          │
  1550. │ 416k │68000-6BFFF│                                                          │
  1551. │ 432k │6C000-6FFFF│                                                          │
  1552. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1553. │ 448k │70000-73FFF│                                                          │
  1554. │ 464k │74000-77FFF│                                                          │
  1555. │ 480k │78000-7BFFF│                                                          │
  1556. │ 496k │7C000-7FFFF│                                                          │
  1557. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1558. │ 512k │80000-83FFF│                                                          │
  1559. │ 528k │84000-87FFF│                                                          │
  1560. │ 544k │88000-8BFFF│  the original IBM PC-1 BIOS limited memory to 544k       │
  1561. │ 560k │8C000-8FFFF│                                                          │
  1562. ├──────┼───────────┼──────────────────────────────────────────────────────────┤
  1563. │ 576k │90000-93FFF│                                                          │
  1564. │ 592k │94000-97FFF│                                                          │
  1565. │ 609k │98000-9BFFF│                                                          │
  1566. │ 624k │9C000-9FFFF│  to 640k (top of RAM address space)                      │
  1567. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1568. │A0000 ***** 64k ***** EGA/VGA starting address                               │
  1569. │A0000 ***** 64k ***** Toshiba 1000 DOS ROM (MS-DOS 2.11V)                    │
  1570. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1571. │ 640k │A0000-A95B0│  MCGA 320x200 256 color video buffer                     │
  1572. │      │     -AF8C0│  MCGA 640x480 2 color video buffer                       │
  1573. │      │     -A3FFF│                                                          │
  1574. │ 656k │A4000-A7FFF│                                                          │
  1575. │ 672k │A8000-ABFFF│      this 64k segment may be used for contiguous DOS     │
  1576. │ 688k │AC000-AFFFF│      RAM with appropriate hardware and software          │
  1577. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1578. │B0000 ***** 64k ***** mono and CGA address                                   │
  1579. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1580. │ 704k │B0000-B3FFF│  4k  monochrome display   | The PCjr and early Tandy 1000│
  1581. │ 720k │B4000-B7FFF│                           | BIOS revector direct write to│
  1582. │ 736k │B8000-BBFFF│  16k CGA uses             | the B8 area to the Video Gate│
  1583. │ 756k │BC000-BFFFF│                           | Array and reserved system RAM│
  1584. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1585. │C0000 ***** 64k *************** expansion ROM                                │
  1586. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1587. │ 768k │C0000-C3FFF│  16k EGA BIOS C000:001E EGA BIOS signature (letters IBM  │
  1588. │ 784k │C4000-C5FFF│                                                          │
  1589. │      │C6000-C63FF│  256 bytes Professional Graphics Display comm. area      │
  1590. │      │C6400-C7FFF│                                                          │
  1591. │ 800k │C8000-CBFFF│  16k hard disk controller BIOS, drive 0 default          │
  1592. │      │CA000      │      some 2nd floppy (high density) controller BIOS      │
  1593. │ 816k │CC000-CDFFF│   8k IBM PC Network NETBIOS                              │
  1594. │      │CE000-CFFFF│                                                          │
  1595. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1596. │D0000 ***** 64k ***** expansion ROM                                          │
  1597. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1598. │ 832k │D0000-D7FFF│  32k IBM Cluster Adapter  | PCjr first ROM cartridge     │
  1599. │      │      DA000│  voice communications     | address area.                │
  1600. │ 848k │D4000-D7FFF│                           | Common expanded memory board │
  1601. │ 864k │D8000-DBFFF│                           | paging area.                 │
  1602. │ 880k │DC000-DFFFF│                           |                              │
  1603. │      │DE000      │  TI Pro default video buffer, 4k in length               │
  1604. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1605. │E0000 ***** 64k ***** expansion ROM                                          │
  1606. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1607. │ 896k │E0000-E3FFF│                           | PCjr second ROM cartridge    │
  1608. │ 912k │E4000-E7FFF│                           | address area                 │
  1609. │ 928k │E8000-EBFFF│                           |                              │
  1610. │ 944k │EC000-EFFFF│                           |    spare ROM sockets on AT   │
  1611. ├──────┴───────────┴──────────────────────────────────────────────────────────┤
  1612. │F0000 ***** 64k ***** system                                                 │
  1613. ├──────┬───────────┬──────────────────────────────────────────────────────────┤
  1614. │ 960k │F0000-F3FFF│  reserved by IBM          |    cartridge address         │
  1615. │ 976k │F4000-     │                           |    area (PCjr cartridge      │
  1616. │      │F6000      │  ROM BASIC Begins         |    BASIC)                    │
  1617. │ 992k │F8000-FB000│                           |                              │
  1618. │ 1008k│FC000-FFFFF│  ROM BASIC and original   |                              │
  1619. │      │           │  BIOS (Compatibility BIOS |                              │
  1620. │      │           │  in PS/2)                 |                              │
  1621. │ 1024k│      FFFFF│  end of memory (1024k) for 8088 machines                 │
  1622. ├──────┼───────────┴─┬────────────────────────────────────────────────────────┤
  1623. │ 384k │100000-15FFFF│ 80286/AT extended memory area, 1Mb motherboard         │
  1624. │ 15Mb │100000-FFFFFF│ 80286/AT extended memory address space                 │
  1625. │ 15Mb │160000-FDFFFF│ Micro Channel RAM expansion (15Mb extended memory)     │
  1626. │ 128k │FE0000-FFFFFF│ system board ROM            (PS/2 Advanced BIOS)       │
  1627. ├──────┼─────────────┴───┬────────────────────────────────────────────────────┤
  1628. │  64k │C0000000-C000FFFF│ Weitek "Abacus" math coprocessor memory-mapped I/O │
  1629. └──────┴─────────────────┴────────────────────────────────────────────────────┘
  1630.  
  1631.  Note that the ROM BIOS has a duplicated address space which causes it to
  1632. "appear" both at the end of the 1 megabyte real mode space and at the end of
  1633. the 16 megabyte protected mode space. The addresses from 0E0000 to 0FFFFF are
  1634. equal to 0FE0000 to 0FFFFFF. This is necessary due to differences in the memory
  1635. addressing between Real and Protected Modes.
  1636.  
  1637.  
  1638.  
  1639. A Brief Guide to Current Memory Terminology ........................... 2**3
  1640.  
  1641. LOW MEMORY - 0000h to around 0:5(something), comprising the 80x8x interrupt
  1642.              vector table, the BIOS Data Area, DOS Data Area, etc.
  1643.  
  1644. CONVENTIONAL MEMORY - from the end of low memory to the beginning of the
  1645.              "reserved by IBM" A000 segment (640k).
  1646.  
  1647. HIGH MEMORY - originally noncontiguous RAM stuffed into the "reserved for
  1648.              ROM expansion" areas, typically segments D000 and E000. DOS
  1649.              normally can't access this memory without a driver of some
  1650.              sort, but it's easy to put RAMdisks and stuff in there.
  1651.  
  1652. CONVENTIONAL MEMORY - extra RAM stuck at A000, assuming the machine already
  1653.              has 640k, appears as conventional memory accessible to DOS
  1654.              and applications. IBM clones can typically add 64k before
  1655.              bumping into a mono card or 96k before hitting a color card.
  1656.              This address is part of the EGA/VGA video RAM area and most
  1657.              EGA cards don't like system memory at A000.
  1658.  
  1659. EXPANDED MEMORY - LIM 3.2, LIM 4.0, or EEMS 3.2 bank switched memory. A
  1660.              RAM "window" allows an app to save a block of RAM to an expansion
  1661.              board. The window size and location varies according to the
  1662.              EMS standard being used.
  1663.  
  1664. EXTENDED MEMORY - this is the "native mode" address space of the 80286 and
  1665.              later chips. The "real mode", or 8088 addressing scheme,
  1666.              sees RAM as a collection of segments and offsets with a limit
  1667.              on segment size. "Protected mode" addressing uses a flat linear
  1668.              addressing scheme. 8088 and 80188 chips do not have extended
  1669.              memory.
  1670.  
  1671. HIGH MEMORY - by fiddling a bit with the segment/offset stuff, you can
  1672.              get an extra block of addressable 8088-mode memory just over
  1673.              the 1 meg address space. Microsoft issued their "HMA" (High
  1674.              Memory Area) standard to try to standardize use of this block.
  1675.              Though it really is "high" memory, "high" had for many years
  1676.              referred to memory between 640k and 1mb. This creates more
  1677.              confusion for new programmers.
  1678.  
  1679. EMS - this is expanded memory as described above
  1680.  
  1681. XMS - Microsoft is pushing an "Extended Memory Standard" which defines
  1682.       a page-switching scheme much like EMS. The only real difference is
  1683.       that XMS uses protected-mode RAM instead of a special paged RAM board.
  1684.  
  1685. XMS - some severely brain-damaged jerk at IBM issued documentation for some
  1686.       IBM *EMS* boards referring to the boards as *XMS*. This was a classic
  1687.       blunder, and now some IBM-followers are picking up the aberrant
  1688.       terminology. This is guaranteed to confuse some people. To make it
  1689.       simple, if it needs an expansion board, it is EMS no matter what the
  1690.       vendor calls it.
  1691.  
  1692.  
  1693. PC Port Assignment .................................................... 2**4
  1694.  
  1695.  
  1696.  These are functions common across the IBM range. The PCjr, PC-AT, PC
  1697. Convertible and PS/2 (both buses) have enhancements. In some cases, the
  1698. AT and PS/2 series ignore, duplicate, or reassign ports arbitrarily. If
  1699. your code incorporates specific port addresses for video or system board
  1700. control it would be wise to have your application determine the machine
  1701. type and video adapter and address the ports as required.
  1702.  
  1703.  hex address                   Function                   Models
  1704.                                                 PCjr|PC|XT|AT|CVT|M30|PS2
  1705.  
  1706.  0000-000F      8237 DMA controller                  PC
  1707.  0010-001F      8237 DMA controller                        AT         PS2
  1708.  0020-0027      8259A interrupt controller
  1709.  0020-002F      IOSGA interrupt function                              PS2
  1710.  0020-003F      8259A interrupt controller  (AT)
  1711.  0020-0021      interrupt controller 1, 8259A        PC    AT         PS2
  1712.  0040-0043      programmable timer 8253              PC
  1713.  0040-0047      programmable timers                                   PS2
  1714.  0040-005F      8253-5 programmable timers                 AT
  1715.                 note 1) 0041 was memory refresh in PCs. Not used in PS/2.
  1716.                      2) A few early 80386 machines used static RAM and did
  1717.                         not use refresh at all. The PCjr refreshes by the
  1718.                         video vertical retrace signal.
  1719.  0060-0063      keyboard controller 8255A            PC
  1720.  0060-006F      8042 keyboard controller                   AT
  1721.  0060           IOSGA keyboard input port                             PS2
  1722.  0061           speaker                         PCjr PC XT AT CVT
  1723.  0061           IOSGA speaker control                             M30 PS2
  1724.  0061           On some clones, setting or clearing bit 2 controls Turbo mode
  1725.  0061           Toshiba 1000 - system command
  1726.  0062           IOSGA configuration control                       M30 PS2
  1727.  0062           Toshiba 1000 - System Status, port C
  1728.  0063           SSGA, undocumented                                    PS2
  1729.  0063           Toshiba 1000 - mode set
  1730.  0064           keyboard auxiliary device                             PS2
  1731.  0065-006A      SSGA, undocumented                                    PS2
  1732.  006B           SSGA, RAM enable/remap                                PS2
  1733.  006C-006F      SSGA, undocumented                                    PS2
  1734.  0070           AT CMOS write internal register
  1735.  0071           AT CMOS read internal register
  1736.  0070-0071      CMOS real-time clock, NMI mask                        PS2
  1737.  0070-007F      CMOS real-time clock, NMI mask             AT
  1738.  0074-0076      reserved                                              PS2
  1739.  0800-008F      SSGA DMA page registers                               PS2
  1740.  0080-009F      DMA page registers, 74LS612                AT
  1741.  0090           central arbitration control port (Micro Channel)
  1742.  0091           card selected feedback           (Micro Channel)
  1743.  0092           system control port A            (Micro Channel)
  1744.  0093           reserved                         (Micro Channel)
  1745.  0094           system board setup               (Micro Channel)
  1746.  0096           POS "CD SETUP" selector          (Micro Channel)
  1747.  00A0-00A1      Interrupt controller 2, 8259A              AT         PS2
  1748.  00A0-00AF      IOSGA NMI mask register                               PS2
  1749.  00B0-00BF      realtime clock/calendar, (undocumented)               PS2
  1750.  00C0-00DF      reserved                        PCjr PC XT AT CVT M30
  1751.  00C0-00CF      DOS ROM register, Toshiba 1000
  1752.  00D0-00EF      "special" register, Toshiba 1000
  1753.       00C0      0C1 key register, Toshiba 1000
  1754.       00C1      keyboard transfer register, Toshiba 1000
  1755.       00C2      keyboard receive register, Toshiba 1000
  1756.       00C3      keyboard status register, Toshiba 1000
  1757.       00C8      DOS ROM page register, Toshiba 1000
  1758.       00E0      CPU speed control, Toshiba 1000
  1759.       00E1      keyboard status/0E2 key register, Toshiba 1000
  1760.       00E2      work register, Toshiba 1000
  1761.       00E3      0E4 key register, Toshiba 1000
  1762.       00E4      system control register 0, Toshiba 1000
  1763.       00E4      Weitek ABACUS NDP - bit 0=1, ABACUS is present
  1764.       00E5      0E6 key register, Toshiba 1000
  1765.       00E6      system control register 1, Toshiba 1000
  1766.       00EE      EMS unit index, Toshiba 1000
  1767.       00EF      EMS unit data, Toshiba 1000
  1768.  00C0-00DF      DMA controller 2, 8237A-5                  AT         PS2
  1769.  00E0-00EF      realtime clock/calendar  (undocumented)           M30 PS2
  1770.  00F0-00FF      PS/2 math coprocessor I/O  (Model 50+)  (diskette IO on PCjr)
  1771.  0100-0101      PS/2 POS adapter ID response            (Micro Channel)
  1772.  0102-0107      PS/2 POS adapter configuration response (Micro Channel)
  1773.  01F0-01F8      hard disk                                  AT         PS2
  1774.  0200-0201      game-control adapter (joystick)
  1775.  0200-020F      game controller                      PC    AT
  1776.  0208-0209      Chips & Technology CS8221 chipset default EMS ports
  1777.                 alternate addresses: 218h, 258h, 268h, 2A8h, 2B8h, 2E8h
  1778.  0208-020F      Toshiba 1000 - EMS unit I/O #1
  1779.  020C-020D      reserved by IBM
  1780.  0210-0217      expansion box (PC, XT)
  1781.  0218-021F      Toshiba 1000 - EMS unit I/O #2
  1782.  021F           reserved by IBM
  1783.  0258-025F      Toshiba 1000 - EMS unit I/O #3
  1784.  0258-0259      LIM EMS 3.1 (not defined in 3.2+)
  1785.  0268-026F      Toshiba 1000 - EMS unit I/O #4
  1786.  0278-027F      parallel printer port 2                    AT
  1787.  0278-027B      parallel printer port 3                               PS2
  1788.  02A2           clock chip in early Sperry PCs
  1789.  02A8-02AF      Toshiba 1000 - EMS unit I/O #5
  1790.  02B8-02BF      Toshiba 1000 - EMS unit I/O #6
  1791.  02B0-02DF      EGA (alternate)                       PC   AT
  1792.  02C0-02DF      Toshiba 1000 - realtime clock
  1793.  02E1           GPIB (adapter 0)                           AT
  1794.  02E2-02E3      data acquisition (adapter 0)               AT
  1795.  02E8           "industry standard" COM4
  1796.  02E8-02EF      Toshiba 1000 - EMS unit I/O #7
  1797.  02F8-02FF      serial communications (COM2)          PC   AT         PS2
  1798.  0300-031F      prototype card                        PC   AT
  1799.  0300-031F      Leading Edge Model D clock            -------------------
  1800.  0320-032F      hard disk controller                  PC
  1801.  0320           Perstor HD controller, primary        -------------------
  1802.  0324           Perstor HD controller, secondary      -------------------
  1803.  0340           Sony CD-ROM                           -------------------
  1804.  0348-0357      DCA 3278
  1805.  0360-0367      PC Network (low address)
  1806.  0368-036F      PC Network (high address)                  AT
  1807.  0370           Colorado Memory external tape backup control port -------
  1808.                 some "second controller" floppy cards -------------------
  1809.  0378-037F      parallel printer port                 PC   AT
  1810.  0378-037B      parallel printer port                                 PS2
  1811.  0380-038F      Eicon Technology Network Adapter (X.25) board (default)
  1812.  0380-038F      SDLC, bi-synchronous 2                PC   AT
  1813.  0380-0389      BSC communications (alternate)        PC
  1814.  0390-039F      Eicon Technology Network Adapter (X.25) board (alternate)
  1815.  0390-0393      cluster (adapter 0)                   PC   AT
  1816.  03A0-03A9      BSC communications (primary)          PC   AT
  1817.  03B0-03BF      monochrome/parallel printer adapter   PC   AT
  1818.  03B4-03B5      video subsystem                                       PS2
  1819.  03BA           video subsystem                                       PS2
  1820.  03BC-03BF      parallel printer port 1                               PS2
  1821.  03C0-03CF      Enhanced Graphics Adapter
  1822.  03C0-03DA      video subsystem and DAC                               PS2
  1823.  03DA           video status register                 AT&T 6300, Olivetti PC
  1824.  03D0-03DF      CGA, MCGA, VGA adapter control
  1825.  03DE           video mode selector register          AT&T 6300, Olivetti PC
  1826.  03E8h          "industry standard" COM3
  1827.  03F0-03F7      floppy disk controller                PC   AT         PS2
  1828.  03F0           Colorado Memory internal tape backup control port -------
  1829.  03F2           DTK high-density XT floppy controller (output only)
  1830.  03F5           DTK high-density XT floppy controller
  1831.  03F8-03FF      serial communications (COM1)          PC   AT         PS2
  1832.  06E2-06E3      data acquisition (adapter 1)               AT
  1833.  0790-0793      cluster (adapter 1)                   PC   AT
  1834.  0878           Compaq 386SX VGA BIOS relocation           AT
  1835.  0AE2-0AE3      data acquisition (adapter 2)               AT
  1836.  0B90-0B93      cluster (adapter 2)                   PC   AT
  1837.  0EE2-0EE3      data acquisition (adapter 3)               AT
  1838.  1390-1393      cluster (adapter 3)                   PC   AT
  1839.  22E1           GPIB (adapter 1)
  1840.  2390-2393      cluster (adapter 4)                   PC   AT
  1841.  4258           LIM EMS 3.1 (not defined in 3.2+)     -------------------
  1842.  42E1           GPIB (adapter 2)                           AT
  1843.  62E1           GPIB (adapter 3)                           AT
  1844.  8258           LIM EMS 3.1 (not defined in 3.2+)     -------------------
  1845.  82E1           GPIB (adapter 4)                           AT
  1846.  A2E1           GPIB (adapter 5)                           AT
  1847.  C258           LIM EMS 3.1 (not defined in 3.2+)     -------------------
  1848.  C2E1           GPIB (adapter 6)                           AT
  1849.  E2E1           GPIB (adapter 7)                           AT
  1850.  
  1851. note 1) IOSGA = I/O Support Gate Array
  1852.         SSGA = System Support Gate Array
  1853.      2) I/O Addresses, hex 000 to 0FF, are reserved for the system board I/O.
  1854.         Hex 100 to 3FF are available on the I/O channel.
  1855.      3) These are the addresses decoded by the current set of adapter cards.
  1856.         IBM may use any of the unlisted addresses for future use.
  1857.      4) SDLC Communication and Secondary Binary Synchronous Communications
  1858.         cannot be used together because their port addresses overlap.
  1859.  
  1860.  
  1861.  
  1862. Reserved Memory Locations ............................................. 2**5
  1863.  
  1864. ┌──────────────────────────────────────────────────────────────────────────────
  1865. │ 000-3FF  - 1k DOS interrupt vector table, 4 byte vectors for ints 00h-0FFh.
  1866. │   30:00  - used as a stack area during POST and bootstrap routines. This
  1867. │to 3F:FF    stack area may be revectored by an application program.
  1868. ├──────────────────────────────────────────────────────────────────────────────
  1869. │ ** The BIOS Data Area ** addresses from 400h to 4FFh
  1870. ├─────┬───────┬────────────────────────────────────────────────────────────────
  1871. │addr.│ size  │                         description
  1872. ├─────┼───────┼────────────────────────────────────────────────────────────────
  1873. │40:00│  word │ COM1 port address |   These addresses are zeroed out in the
  1874. │40:02│  word │ COM2 port address |   OS/2 DOS Compatibility Box if any of
  1875. │40:04│  word │ COM3 port address |   the OS/2 COMxx.SYS drivers are loaded.
  1876. │40:06│  word │ COM4 port address |
  1877. │40:08│  word │ LPT1 port address
  1878. │40:0A│  word │ LPT2 port address
  1879. │40:0C│  word │ LPT3 port address
  1880. │40:0E│  word │ LPT4 port address        (not valid in PS/2 machines)
  1881. │40:0E│  word │ PS/2 pointer to 1k extended BIOS Data Area at top of RAM
  1882. │40:10│  word │ equipment flag (see int 11h)
  1883. └─────┴───────┤ bits:
  1884.               │ 0       0       no floppy drive present
  1885.               │         1       if floppy drive present (see bits 6&7)
  1886.               │ 1       0       no math coprocessor installed
  1887.               │         1       if 80x87 installed  (not valid in PCjr)
  1888.               │ 2,3     system board RAM   (not used on AT or PS/2)
  1889.               │         0,0     16k             0,1     32k
  1890.               │         1,0     48k             1,1     64k
  1891.               │ 4,5     initial video mode
  1892.               │         0,0     no video adapter
  1893.               │         0,1     40 column color  (PCjr default)
  1894.               │         1,0     80 column color
  1895.               │         1,1     MDA
  1896.               │ 6,7     number of diskette drives
  1897.               │         0,0     1 drive         0,1     2 drives
  1898.               │         1,0     3 drives        1,1     4 drives
  1899.               │ 8       0       DMA present
  1900.               │         1       DMA not present (PCjr, Tandy 1400, Sanyo 55x)
  1901.               │ 9,A,B   number of RS232 serial ports
  1902.               │ C       game adapter  (joystick)
  1903.               │         0       no game adapter
  1904.               │         1       if game adapter
  1905.               │ D       serial printer (PCjr only)
  1906.               │         0       no printer
  1907.               │         1       serial printer present
  1908.        ┌──────┘ E,F     number of parallel printers installed
  1909.        │note 1) The IBM PC and AT store the settings of the system board
  1910.        └───┐    switches or CMOS RAM setup information (as obtained by the BIOS
  1911.            │    in the Power-On Self Test (POST)) at addresses 40:10h and
  1912.            │    40:13h. 00000001b indicates "on", 00000000b is "off".
  1913. ┌─────┬────┴──┐
  1914. │40:12│  byte │ reserved (PC, AT)
  1915. └─────┴───────┤  number of errors detected by infrared keyboard link (PCjr)
  1916. ┌─────┬───────┤  POST status (Convertible)
  1917. │40:13│  word │ availible memory size in Kbytes (less display RAM in PCjr)
  1918. ├─────┼───────┤  this is the value returned by int 12h
  1919. │40:15│  word │ reserved
  1920. │40:17│  byte │ keyboard flag byte 0 (see int 9h)
  1921. └─────┴───────┤ bit 7  insert mode on      3  alt pressed
  1922.               │     6  capslock on         2  ctrl pressed
  1923.               │     5  numlock on          1  left shift pressed
  1924. ┌─────┬───────┤     4  scrollock on        0  right shift pressed
  1925. │40:18│  byte │ keyboard flag byte 1 (see int 9h)
  1926. └─────┴───────┤ bit 7  insert pressed      3  ctrl-numlock (pause) toggled
  1927.               │     6  capslock pressed    2  PCjr keyboard click active
  1928.               │     5  numlock pressed     1  PCjr ctrl-alt-capslock held
  1929. ┌─────┬───────┤     4  scrollock pressed   0
  1930. │40:19│  byte │ storage for alternate keypad entry (not normally used)
  1931. │40:1A│  word │ pointer to keyboard buffer head character
  1932. │40:1C│  word │ pointer to keyboard buffer tail character
  1933. │40:1E│32bytes│ 16 2-byte entries for keyboard circular buffer, read by int 16h
  1934. │40:3E│  byte │ drive seek status - if bit=0, next seek will recalibrate by
  1935. └─────┴───────┤ repositioning to Track 0.
  1936.               │ bit 3  drive D          bit 2  drive C
  1937. ┌─────┬───────┤     1  drive B              0  drive A
  1938. │40:3F│  byte │ diskette motor status (bit set to indicate condition)
  1939. └─────┴───────┤ bit 7  write in progress    3  motor on (floppy 3)
  1940.               │     6                       2  motor on (floppy 2)
  1941.               │     5                       1  B: motor on (floppy 1)
  1942. ┌─────┬───────┤     4                       0  A: motor on (floppy 0)
  1943. │40:40│  byte │ motor off counter
  1944. │     │       │ starts at 37 and is decremented 1 by each system clock tick.
  1945. │     │       │ motor is shut off when count = 0.
  1946. │40:41│  byte │ status of last diskette operation     where:
  1947. └─────┴───────┤ bit 7 timeout failure                3 DMA overrun
  1948.               │     6 seek failure                   2 sector not found
  1949.               │     5 controller failure             1 address not found
  1950. ┌─────┬───────┤     4 CRC failure                    0 bad command
  1951. │40:42│7 bytes│ NEC floppy controller chip status
  1952. │40:49│  byte │ Video Control Data Area 1 from 0040:0049 through 0040:0066
  1953. └─────┴───────┤ current CRT mode (hex value)
  1954.               │    00h 40x25 BW      (CGA)          01h 40x25 color   (CGA)
  1955.               │    02h 80x25 BW      (CGA)          03h 80x25 color   (CGA)
  1956.               │    04h 320x200 color (CGA)          05h 320x200 BW    (CGA)
  1957.               │    06h 640x200 BW    (CGA)          07h monochrome    (MDA)
  1958.               │extended video modes (EGA/MCGA/VGA or other)
  1959.               │    08h lores,16 color               09h med res,16 color
  1960.               │    0Ah hires,4 color                0Bh n/a
  1961.               │    0Ch med res,16 color             0Dh hires,16 color
  1962. ┌─────┬───────┤    0Eh hires,4 color                0Fh hires,64 color
  1963. │40:4A│  word │ number of columns on screen, coded as hex number of columns
  1964. └─────┴───────┤ 20 col = 14h  (video mode 8, low res 160x200 CGA graphics)
  1965.               │ 40 col = 28h
  1966. ┌─────┬───────┤ 80 col = 46h
  1967. │40:4C│  word │ screen buffer length in bytes
  1968. ├─────┼───────┤(number of bytes used per screen page, varies with video mode)
  1969. │40:4E│  word │ current screen buffer starting offset (active page)
  1970. │40:50│8 words│ cursor position pages 1-8
  1971. └─────┴───────┤ the first byte of each word gives the column (0-19, 39, or 79)
  1972. ┌─────┬───────┤ the second byte gives the row (0-24)
  1973. │40:60│  byte │ end line for cursor   (normally 1)
  1974. │40:61│  byte │ start line for cursor (normally 0)
  1975. │40:62│  byte │ current video page being displayed  (0-7)
  1976. │40:63│  word │ base port address of 6845 CRT controller or equivalent
  1977. ├─────┼───────┤ for active display           3B4h=mono, 3D4h=color
  1978. │40:65│  byte │ current setting of the CRT mode register
  1979. │40:66│  byte │ current palette mask setting  (CGA)
  1980. │40:67│5 bytes│ temporary storage for SS:SP during shutdown (cassette interface)
  1981. │40:6C│  word │ timer counter low word
  1982. │40:6E│  word │ timer counter high word
  1983. │40:69│  byte │ HD_INSTALL (Columbia PCs) (not valid on most clone computers)
  1984. └─────┴───────┤ bit  0    0  8 inch external floppy drives
  1985.               │           1  5-1/4 external floppy drives
  1986.               │      1,2     highest drive address which int 13 will accept
  1987.               │              (since the floppy drives are assigned 0-3,subtract
  1988.               │              3 to obtain the number of hard disks installed)
  1989.               │      4,5     # of hard disks connected to expansion controller
  1990.               │      6,7     # of hard disks on motherboard controller
  1991.               │              (if bit 6 or 7 = 1, no A: floppy is present and
  1992. ┌─────┬───────┤              the maximum number of floppies from int 11 is 3)
  1993. │40:70│  byte │ 24 hour timer overflow 1 if timer went past midnight
  1994. ├─────┼───────┤ it is reset to 0 each time it is read by int 1Ah
  1995. │40:71│  byte │ BIOS break flag (bit 7 = 1 means break key hit)
  1996. │40:72│  word │ reset flag
  1997. └─────┴───────┤ PCjr keeps 1234h here for softboot when a cartridge is installed
  1998.               │ bits 1234h = soft reset, memory check will be bypassed
  1999.               │      4321h = preserve memory         (PS/2 only)
  2000.               │      5678h = system suspended        (Convertible)
  2001.               │      9ABCh = manufacturing test mode (Convertible)
  2002. ┌─────┬───────┤      ABCDh = system POST loop mode   (Convertible)
  2003. │40:74│  byte │ status of last hard disk operation ; PCjr special disk control
  2004. │40:75│  byte │ # of hard disks attached (0-2)     ; PCjr special disk control
  2005. │40:76│  byte │ HD control byte; temp holding area for 6th param table entry
  2006. │40:77│  byte │ port offset to current hd adapter  ; PCjr special disk control
  2007. │40:78│4 bytes│ timeout value for LPT1,LPT2,LPT3,LPT4
  2008. │40:7C│4 bytes│ timeout value for COM1,COM2,COM3,COM4 (0-0FFh secs, default 1)
  2009. │40:80│  word │ pointer to start of circular keyboard buffer, default 03:1E
  2010. │40:82│  word │ pointer to end of circular keyboard buffer, default 03:3E
  2011. └─────┴───────┤ note: early Zenith Z183 BIOS set these pointers to zero and
  2012. ┌─────┬───────┤       ignored them.
  2013. │40:84│  .... │ Video Control Data Area 2, 0040:0084 through 0040:008A
  2014. │40:84│  byte │ rows on the screen minus 1 (EGA only)
  2015. │40:84│  byte │ PCjr interrupt flag; timer channel 0  (used by POST)
  2016. │40:85│  word │ bytes per character (EGA only)
  2017. │40:85│2 bytes│ (PCjr only) typamatic character to repeat
  2018. │40:86│2 bytes│ (PCjr only) typamatic initial delay
  2019. │40:87│  byte │ mode options (EGA only)
  2020. └─────┴───────┤ bit 0   0   cursor emulation in effect
  2021.               │         1   no cursor emulation
  2022.               │     1   0   EGA is connected to a color display
  2023.               │         1   EGA is connected to monochrome TTL display
  2024.               │     2   0   wait for vertical retrace (CGA active)
  2025.               │         1   don't wait for vertical retrace (EGA or MDA active)
  2026.               │     3   0   EGA is the active display,
  2027.               │         1   "other" display is active.
  2028.               │     4       reserved
  2029.               │     5,6     EGA memory size
  2030.               │             0,0   64k
  2031.               │             0,1   128k
  2032.               │             1,0   192k
  2033.               │             1,1   256k
  2034.               │     7   0   don't clear screen on mode changes
  2035.               │         1   if the last "set mode" specified not to clear the
  2036.               │             video buffer
  2037.               │ mode combinations:
  2038.               │ bit3  bit1     Meaning
  2039.               │   0     0   EGA is active display and is color
  2040.               │   0     1   EGA is active display and is monochrome
  2041.               │   1     0   EGA is not active, a mono card is active
  2042. ┌─────┬───────┤   1     1   EGA is not active, a CGA is active
  2043. │40:87│  byte │ (PCjr only) current Fn key code
  2044. ├─────┼───────┤             80h bit indicates make/break key code?
  2045. │40:88│  byte │ feature bits and switches (EGA only) 0=on, 1=off
  2046. └─────┴───────┤ bit 0   switch 1
  2047.               │     1   switch 2
  2048.               │     2   switch 3
  2049.               │     3   switch 4
  2050. ┌─────┬───────┤     4-7 feature bits
  2051. │40:88│  byte │ (PCjr only) special keyboard status byte
  2052. └─────┴───────┤ bit 7 function flag      3 typamatic (0=enable,1=disable)
  2053.               │     6 Fn-B break         2 typamatic speed (0=slow,1=fast)
  2054.               │     5 Fn pressed         1 extra delay bef.typamatic (0=enable)
  2055. ┌─────┬───────┤     4 Fn lock            0 write char, typamatic delay elapsed
  2056. │40:89│  byte │ (PCjr) current value of 6845 reg 2 (horizontal synch) used by
  2057. └─────┴───────┤ ctrl-alt-cursor screen positioning routine in ROM
  2058.               │  (VGA)
  2059.               │ bit 0       reserved
  2060.               │     1       video summing enabled
  2061.               │     2   0   for color monitor attached
  2062.               │         1   for mono monitor
  2063.               │     3   0   for default palette loading enabled
  2064.               │     4   0   for 8x8 text font
  2065.               │         1   for 8x16 text font
  2066. ┌─────┬───────┤     5-7     reserved
  2067. │40:8A│  byte │ (PCjr) CRT/CPU Page Register Image, default 3Fh
  2068. └─────┴───────┤ (VGA)  Display Combination Code Index. This is the value
  2069.               │  set/returned by function 1Ah of the Video BIOS. This byte
  2070.               │  contains an index into the ROM BIOS Display Combination Code
  2071.               │  table, which is a list of byte pairs that specify valid
  2072.               │  combinations of one or two video subsystems. Video subsystems
  2073.               │  are designated by the following values:
  2074.               │  00h     no display
  2075.               │  01h     MDA with monochrome display
  2076.               │  02h     CGA with color display
  2077.               │  03h     reserved
  2078.               │  04h     EGA with color display
  2079.               │  05h     EGA with monochrome display
  2080.               │  06h     Professional Graphics Adapter
  2081.               │  07h     VGA with analog monochrome display
  2082.               │  08h     VGA with analog color display
  2083.               │  09h     reserved
  2084.               │  0Ah     MCGA with digital color display
  2085.               │  0Bh     MCGA with analog monochrome display
  2086.               │  0Ch     MCGA with analog color display
  2087. ┌─────┬───────┤  0FFh    unrecognized video subsystem
  2088. │40:8B│  byte │ last diskette data rate selected
  2089. └─────┴───────┤ bit 7,6 starting data transfer rate to use
  2090.               │         0,0      500 kb/sec
  2091.               │         0,1      300 kb/sec
  2092.               │         1,0      250 kb/sec
  2093.               │         1,1      reserved
  2094.               │     5,4 last step rate selected
  2095.               │     3   ending data transfer rate to use
  2096.               │     2   reserved
  2097.               │     1   reserved
  2098.               │     0   1  combination floppy/fixed disk controller detected
  2099.               │         0  XT floppy only controller (for 360kb drive) detected
  2100.               │                Data Transfer Rates
  2101.               │       Kbits/sec     Media   Drive   Sectors/Track
  2102.               │         250         360k    360k        9
  2103.               │         300         360k    1.2M        9
  2104.               │         500         1.2M    1.2M       15
  2105.               │         250         720k    720k        9
  2106.               │         250         720k    1.4M        9
  2107. ┌─────┬───────┤         500         1.4M    1.4M       18
  2108. │40:8C│  byte │ hard disk status returned by controller
  2109. │40:8D│  byte │ hard disk error returned by controller
  2110. │40:8E│  byte │ hard disk interrupt (bit 7=working interrupt)
  2111. │40:8F│  byte │ combo_card - status of drives 0 and 1
  2112. └─────┴───────┤ bit 7   reserved
  2113.               │     6   drive type determined for drive 1
  2114.               │     5   drive multiple data rate capability for drive 1
  2115.               │         0       no multiple data rate
  2116.               │         1       multiple data rate
  2117.               │     4   1 then drive 1 has 80 tracks
  2118.               │         0 then drive 1 has 40 tracks
  2119.               │     3   reserved
  2120.               │     2   drive type determined for drive 0
  2121.               │     1   drive multiple data rate capability for drive 0
  2122.               │         0       no multiple data rate
  2123.               │         1       multiple data rate
  2124.               │     0   1       the drive 0 has 80 tracks
  2125. ┌─────┬───────┤         0       the drive 0 has 40 tracks
  2126. │40:90│4 bytes│ media state drive 0, 1, 2, 3
  2127. └─────┴───────┤ floppy_media_state
  2128.               │ bit 7,6 Data transfer rate
  2129.               │         00 - 500 K/sec
  2130.               │         01 - 300 K/sec
  2131.               │         10 - 250 K/sec
  2132.               │         11 - reserved
  2133.               │     5   double stepping required
  2134.               │     4   media/drive determined
  2135.               │     3   reserved
  2136.               │     2-0 present state
  2137.               │         000  360k in 360k unestablished
  2138.               │         001  360k in 1.2M unestablished
  2139.               │         010  1.2M in 1.2M unestablished
  2140.               │         011  360k in 360k established
  2141.               │         100  360k in 1.2M established
  2142.               │         101  1.2M in 1.2M established
  2143.               │         110  reserved
  2144. ┌─────┬───────┤         111  none of the above
  2145. │40:94│2 bytes│ track currently seeked to drive 0, 1
  2146. │40:96│  byte │ keyboard flag byte 3 (see int 9h)
  2147. │40:97│  byte │ keyboard flag byte 2 (see int 9h)
  2148. │40:98│ dword │ segment:offset pointer to users wait flag
  2149. │40:9C│ dword │ users timeout value in microseconds
  2150. │40:A0│  byte │ real time clock wait function in use
  2151. └─────┴───────┤ bits 7    wait time elapsed and posted flag
  2152.               │      6-1  reserved
  2153. ┌─────┬───────┤      0    int 15h, function 86h (WAIT) has occurred
  2154. │40:A1│  byte │ LAN A DMA channel flags
  2155. │40:A2│2 bytes│ status LAN A 0,1
  2156. │40:A4│ dword │ saved hard disk interrupt vector
  2157. │40:A8│ dword │ SAVE_PTR: EGA pointer to table of 7 parameters in segment:
  2158. └─────┴───────┤           offset format. Format of table:
  2159.               │ D_1 dword   pointer to 1472 byte table of 64 video parameters
  2160.               │ D_2 dword   reserved
  2161.               │ D_3 dword   reserved
  2162.               │ D_4 dword   reserved
  2163.               │ D_5 dword   reserved for future use
  2164.               │ D_6 dword   reserved for future use
  2165. ┌─────┬───────┤ D_7 dword   reserved for future use
  2166. │40:B0│2 words│ international support                   (Tandy 1000 TX)
  2167. │40:B4│  byte │ keyboard NMI control flags              (Convertible)
  2168. │40:B4│  byte │ monochrome monitor hookup detect        (Tandy 1000 TX)
  2169. │     │       │ 00h not present   0FFh  present
  2170. │40:B5│ dword │ keyboard break pending flags            (Convertible)
  2171. │40:B5│  byte │ extended equipment detect  (5 bits)     (Tandy 1000 TX)
  2172. └─────┴───────┤ bit 0 = 0   drive A is 5¼
  2173.               │         1   drive A is 3½
  2174.               │     1 = 0   drive A is 5¼
  2175.               │         1   drive A is 3½
  2176.               │     2 = 0   Tandy 1000 keyboard layout
  2177.               │         1   IBM keyboard layout
  2178.               │     3 = 0   CPU slow mode
  2179.               │         1   CPU fast mode
  2180.               │     4 = 0   internal color video support enabled
  2181.               │         1   internal color video support disabled, external
  2182.               │             video enabled (chg from mb'd to expansion card)
  2183.               │     5 = 0   no external monochrome video installed
  2184. ┌─────┬───────┤         1   external monochrome video installed
  2185. │40:B6│  byte │ extended equipment detect  (1 bit)      (Tandy 1000 TX)
  2186. └─────┴───────┤ bit 0 = 0   drive C is 5¼
  2187. ┌─────┬───────┤         1   drive C is 3½
  2188. │40:B9│  byte │ port 60 single byte queue               (Convertible)
  2189. │40:BA│  byte │ scan code of last key                   (Convertible)
  2190. │40:BB│  byte │ pointer to NMI buffer head              (Convertible)
  2191. │40:BC│  byte │ pointer to NMI buffer tail              (Convertible)
  2192. │40:BD│16bytes│ NMI scan code buffer                    (Convertible)
  2193. │40:CE│  word │ day counter                             (Convertible and after)
  2194. │  to │ -04:8F│               end of BIOS Data Area
  2195. ├─────┴───────┴────────────────────────────────────────────────────────────────
  2196. │ ** End of BIOS Data Area **
  2197. ├─────┬───────┬────────────────────────────────────────────────────────────────
  2198. │40:90│-40:EF │ reserved by IBM
  2199. │40:F0│16bytes│ Inter-Application Communications Area (for use by applications
  2200. │40:FF│       │ to transfer data or parameters to each other)
  2201. └─────┴───────┤ 1) Used by Turbo Power's FMARK (mark memory for TSRs).
  2202.               │ 2) Used by Norton Utilities' TimeMark to store the time.
  2203.               │ 3) Used by BRIEF editor.
  2204. ┌─────┬───────┤
  2205. │50:00│ byte  │ DOS print screen status flag
  2206. └─────┴───────┤        00h    not active or successful completion
  2207.               │        01h    print screen in progress
  2208. ┌─────┬───────┤        0FFh   error during print screen operation
  2209. │50:01│       │ Used by BASIC
  2210. │50:02-03     │ PCjr POST and diagnostics work area
  2211. │50:04│  byte │ Single drive mode status byte - not used by AT&T DOS 2.11!
  2212. └─────┴───────┤         00     logical drive A was last active
  2213. ┌─────────────┤         01     logical drive B was last active
  2214. │50:05-0E     │ PCjr POST and diagnostics work area
  2215. │50:0F│       │ BASIC: SHELL flag (set to 02h if there is a current SHELL)
  2216. │50:10│  word │ BASIC: segment address storage (set with DEF SEG)
  2217. │50:12│4 bytes│ BASIC: int 1Ch clock interrupt vector segment:offset storage
  2218. │50:16│4 bytes│ BASIC: int 23h ctrl-break interrupt segment:offset storage
  2219. │50:1A│4 bytes│ BASIC: int 24h disk error int vector segment:offset storage
  2220. │50:1B-1F     │ Used by BASIC for dynamic storage
  2221. │50:20-21     │ Used by DOS for dynamic storage
  2222. │50:22-2C     │ Used by DOS for diskette parameter table. See int 1Eh for values
  2223. └─────┴───────┤ In DOS 1.0 this is located in the ROM BIOS, but in DOS 1.1 and
  2224.               │ subsequent it is a part of DOS located at 05:22. The first byte
  2225.               │ (out of eleven) of the Disk Parameter contains the hexadecimal
  2226.               │ value CF in DOS 1.0 and DF in DOS 1.1 and later.
  2227.               │ DOS 1.0   24ms
  2228. ┌─────────────┤ DOS 1.1   26ms
  2229. │50:30-33     │ Used by MODE command
  2230. │50:81│       │ number of floppies installed in the system?
  2231. │50:82│       │ first hard disk drive?
  2232. │50:83│       │ last hard disk drive?
  2233. │50:34-FF     │ Unknown - Reserved for DOS
  2234. └─────────────┴─────────────────────────────────────────────────────────────────
  2235.  
  2236.  
  2237.  
  2238. Absolute Addresses .................................................... 2**6
  2239.  
  2240. 0008:0047 IO.SYS or IBMBIO.COM IRET instruction. This is the dummy routine that
  2241.           interrupts 01h, 03h, and 0Fh are initialized to during POST.
  2242. C000:001E EGA BIOS signature (the letters IBM)
  2243. F000:FA6E table of characters 00h-7Fh used by int 10h video BIOS
  2244.           The first 128 characters are stored here and each occupies 8 bytes.
  2245.           The high bit ones are somewhere on the video adapter card.
  2246. F000:FFF5 BIOS release date
  2247. F000:FFFE PC model identification
  2248.  
  2249.      ┌─────────────────────────────────────────────────────────────────────┐
  2250.      │ ROM BIOS    ┌ model byte                                            │
  2251.      │ copyright   │    ┌ submodel byte          machine                   │
  2252.      │   date      │    │    ┌ revision                                    │
  2253.      ├──────────┼────┼────┼────┼───────────────────────────────────────────┤
  2254.      │          │ 00 │ 00 │ 00 │ AT&T 6300, Olivetti PC                    │
  2255.      │ 09/02/86 │ FA │ 00 │ 00 │ PS/2 Model 30                             │
  2256.      │ 01/10/86 │ FB │ 00 │ 00 │ XT-2 (early)                              │
  2257.      │ 01/10/86 │ FB │ 00 │ 01 │ XT Model 089                              │
  2258.      │ 05/09/86 │ FB │ 01 │ 02 │ XT-2 (revised)                            │
  2259.      │ 01/10/84 │ FC │ -- │ -- │ AT Model 099 (original)                   │
  2260.      │ 06/10/85 │ FC │ 00 │ 01 │ AT Model 239 6mHz      (6.6 max governor) │
  2261.      │ 11/15/85 │ FC │ 01 │ 00 │ AT Model 339, 339 8mHz (8.6 max governor) │
  2262.      │          │ FC │ 01 │ 00 │ Compaq 386/16                             │
  2263.      │          │ FC │ 01 │ 03 │ some Phoenix 386 BIOS                     │
  2264.      │          │ FC │ 01 │ 81 │ some Phoenix 386 BIOS                     │
  2265.      │ 04/21/86 │ FC │ 02 │ 00 │ XT/286                                    │
  2266.      │ 02/13/87 │ FC │ 04 │ 00 │ PS/2 Model 50                             │
  2267.      │ 02/13/87 │ FC │ 05 │ 00 │ PS/2 Model 60                             │
  2268.      │          │ FC │ 00 │    │ 7531/2 Industrial AT                      │
  2269.      │          │ FC │ 06 │    │ 7552 "Gearbox"                            │
  2270.      │ 04/18/88 │ FC │ 04 │ 03 │ PS/2 50Z                                  │
  2271.      │ 01/24/90 │ FC │ 01 │ 00 │ Compaq Deskpro 80386/25e                  │
  2272.      │ 10/02/89 │ FC │ 02 │ 00 │ Compaq Deskpro 386s, 386SX, 16mHz         │
  2273.      │ 06/01/83 │ FD │ -- │ -- │ PCjr                                      │
  2274.      │ 11/08/82 │ FE │ -- │ -- │ XT, Portable PC, XT/370, 3270PC           │
  2275.      │ 04/24/81 │ FF │ -- │ -- │ PC-0             (16k motherboard)        │
  2276.      │ 10/19/81 │ FF │ -- │ -- │ PC-1             (64k motherboard)        │
  2277.      │ 08/16/82 │ FF │ -- │ -- │ PC, XT, XT/370   (256k motherboard)       │
  2278.      │ 10/27/82 │ FF │ -- │ -- │ PC, XT, XT/370   (256k motherboard)       │
  2279.      │   ? 1987 │ F8 │ 00 │ 00 │ PS/2 Model 80                             │
  2280.      │  3/30/87 │ F8 │ 00 │ 00 │ PS/2 Model 80-041  16mHz                  │
  2281.      │ 08/28/87 │ F8 │ ?? │ ?? │ PS/2 Model 80-071  16mHz                  │
  2282.      │   ? 1987 │ F8 │ 01 │ 00 │ PS/2 Model 80      20mHz                  │
  2283.      │ 09/17/87 │ F8 │ 01 │ 01 │ PS/2 Model 80-111  20mHz                  │
  2284.      │        ? │ F8 │ 04 │  ? │ PS/2 Model 70-121                         │
  2285.      │ 01/18/89 │ F8 │ 0B │ 00 │  PS/2 Model 70 Portable                   │
  2286.      │ 04/11/88 │ F8 │ 09 │ 02 │  PS/2 Model 70 desktop                    │
  2287.      │ 02/20/89 │ F8 │ 0D │    │  PS/2 Model 70-A21                        │
  2288.      │ 09/13/85 │ F9 │ 00 │ 00 │ Convertible                               │
  2289.      │          │ 2D │ -- │ -- │ Compaq PC        (4.77mHz original)       │
  2290.      │          │ 9A │ -- │ -- │ Compaq Plus      (XT compatible)          │
  2291.      └──────────┴────┴────┴────┴───────────────────────────────────────────┘
  2292.  
  2293.  
  2294.  
  2295. The IBM PC System Interrupts (Overview) ............................... 2**7
  2296.  
  2297.  The interrupt table is stored in the very lowest location in memory, starting
  2298. at 0000:0000h. The locations are offset from segment 0, i.e. location 0000h has
  2299. the address for int 0, etc. The table is 1024 bytes in length and contains 256
  2300. four byte vectors from 00h to 0FFh. Each address' location in memory can be
  2301. found by multiplying the interrupt number by 4. For example, int 7 could be
  2302. found by (7x4=28) or 1Bh (0000:001Bh).
  2303.  
  2304.  These interrupt vectors normally point to ROM tables or are taken over by DOS
  2305. when an application is run. Some applications revector these interrupts to
  2306. their own code to change the way the system responds to the user. DOS provides
  2307. int 21h function 25h to change interrupts from a high level; altering the
  2308. interrupt vector table directly is not recommended, nor would it really get
  2309. you anywhere.
  2310.  
  2311.  
  2312. Quick Chart of Interrupts 00h-0FFh .................................... 2**8
  2313.  
  2314. ┌─────────────────────┬────────────────────────────────────────────────────────┐
  2315. │  Interrupt Address  │                                                        │
  2316. ├───────┬───────┬─────┘                        Function                        │
  2317. │ Number│ (Hex) │ Type                                                         │
  2318. ├───────┼───────┼─────┬────────────────────────────────────────────────────────┤
  2319. │   0   │ 00-03 │ CPU │  Divide by Zero                                        │
  2320. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2321. │   1   │ 04-07 │ CPU │  Single Step                                           │
  2322. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2323. │   2   │ 08-0B │ CPU │  Nonmaskable                                           │
  2324. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2325. │   3   │ 0C-0F │ CPU │  Breakpoint                                            │
  2326. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2327. │   4   │ 10-13 │ CPU │  Overflow                                              │
  2328. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2329. │   5   │ 14-17 │ BIOS│  Print Screen                                          │
  2330. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2331. │   6   │ 18-1B │ hdw │  Reserved                                              │
  2332. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2333. │   7   │ 1C-1F │ hdw │  Reserved                                              │
  2334. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2335. │   8   │ 20-23 │ hdw │  Time of Day                                           │
  2336. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2337. │   9   │ 24-27 │ hdw │  Keyboard                                              │
  2338. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2339. │   A   │ 28-2B │ hdw │  Reserved                                              │
  2340. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2341. │   B   │ 2C-2F │ hdw │  Communications (8259)                                 │
  2342. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2343. │   C   │ 30-33 │ hdw │  Communications                                        │
  2344. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2345. │   D   │ 34-37 │ hdw │  Disk                                                  │
  2346. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2347. │   E   │ 38-3B │ hdw │  Diskette                                              │
  2348. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2349. │   F   │ 3C-3F │ hdw │  Printer                                               │
  2350. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2351. │   10  │ 40-43 │ BIOS│  Video                                                 │
  2352. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2353. │   11  │ 44-47 │ BIOS│  Equipment Check                                       │
  2354. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2355. │   12  │ 48-4B │ BIOS│  Memory                                                │
  2356. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2357. │   13  │ 4C-4F │ BIOS│  Diskette/Disk                                         │
  2358. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2359. │   14  │ 50-53 │ BIOS│  Serial Communications                                 │
  2360. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2361. │   15  │ 54-57 │ BIOS│  Cassette, System Services                             │
  2362. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2363. │   16  │ 58-5B │ BIOS│  Keyboard                                              │
  2364. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2365. │   17  │ 5C-5F │ BIOS│  Parallel Printer                                      │
  2366. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2367. │   18  │ 60-63 │ BIOS│  ROM BASIC Loader                                      │
  2368. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2369. │   19  │ 64-67 │ BIOS│  Bootstrap Loader                                      │
  2370. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2371. │   1A  │ 68-6B │ BIOS│  Time of Day                                           │
  2372. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2373. │   1B  │ 6C-6F │ BIOS│  Keyboard Break                                        │
  2374. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2375. │   1C  │ 70-73 │ BIOS│  Timer Tick                                            │
  2376. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2377. │   1D  │ 74-77 │ BIOS│  Video Initialization                                  │
  2378. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2379. │   1E  │ 78-7B │ BIOS│  Diskette Parameters                                   │
  2380. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2381. │   1F  │ 7C-7F │ BIOS│  Video Graphics Characters, second set                 │
  2382. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2383. │   20  │ 80-83 │ DOS │  General Program Termination                           │
  2384. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2385. │   21  │ 84-87 │ DOS │  DOS Services Function Request                         │
  2386. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2387. │   22  │ 88-8B │ DOS │  Called Program Termination Address                    │
  2388. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2389. │   23  │ 8C-8F │ DOS │  Control Break Termination Address                     │
  2390. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2391. │   24  │ 90-93 │ DOS │  Critical Error Handler                                │
  2392. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2393. │   25  │ 94-97 │ DOS │  Absolute Disk Read                                    │
  2394. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2395. │   26  │ 98-9B │ DOS │  Absolute Disk Write                                   │
  2396. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2397. │   27  │ 9C-9F │ DOS │  Terminate and Stay Resident                           │
  2398. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2399. │ 28-3F │ A0-FF │ DOS │  Reserved for DOS                                      │
  2400. └───────┴───────┴─────┼────────────────────────────────────────────────────────┤
  2401.                       │ *29h   Fast Screen Write                               │
  2402.                       │ *2Ah   Microsoft Networks - Session Layer Interrupt    │
  2403.                       │  2Fh   Multiplex Interrupt                             │
  2404.                       │ *30h   Far jump instruction for CP/M-style calls       │
  2405.                       │  33h   Used by Microsoft Mouse Driver                  │
  2406. ┌───────┬───────┬─────┼────────────────────────────────────────────────────────┤
  2407. │ 40-43 │100-115│ BIOS│  Reserved for BIOS                                     │
  2408. └───────┴───────┴─────┼────────────────────────────────────────────────────────┤
  2409.                       │  40h   Hard Disk BIOS                                  │
  2410.                       │  41h   Hard Disk Parameters  (except PC1)              │
  2411.                       │  42h   Pointer to screen BIOS entry  (EGA, VGA, PS/2)  │
  2412.                       │  43h   Pointer to EGA initialization parameter table   │
  2413. ┌───────┬───────┬─────┼────────────────────────────────────────────────────────┤
  2414. │   44  │116-119│ BIOS│  First 128 Graphics Characters                         │
  2415. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2416. │ 45-47 │120-131│ BIOS│  Reserved for BIOS                                     │
  2417. └───────┴───────┴─────┼────────────────────────────────────────────────────────┤
  2418.                       │  45h   Reserved by IBM  (not initialized)              │
  2419.                       │  46h   Pointer to hard disk 2 params (AT, PS/2)        │
  2420.                       │  47h   Reserved by IBM  (not initialized)              │
  2421. ┌───────┬───────┬─────┼────────────────────────────────────────────────────────┤
  2422. │   48  │132-135│ BIOS│  PCjr Cordless Keyboard Translation                    │
  2423. ├───────┼───────┼─────┼────────────────────────────────────────────────────────┤
  2424. │   49  │136-139│ BIOS│  PCjr Non-Keyboard Scancode Translation Table          │
  2425. └───────┴───────┴─────┼────────────────────────────────────────────────────────┤
  2426.                       │  4Ah   Real-Time Clock Alarm (Convertible, PS/2)       │
  2427. ┌───────┬───────┬─────┼────────────────────────────────────────────────────────┤
  2428. │ 50-5F │140-17F│ BIOS│  Reserved for BIOS                                     │
  2429. └───────┴───────┴─────┼────────────────────────────────────────────────────────┤
  2430.                       │  5Ah   Cluster Adapter BIOS entry address              │
  2431.                       │ *5Bh   IBM  (cluster adapter?)                         │
  2432.                       │  5Ch   NETBIOS interface entry port                    │
  2433. ┌───────┬───────┬─────┴────────────────────────────────────────────────────────┤
  2434. │ 60-67 │180-19F│  User Program Interrupts (availible for general use)         │
  2435. └───────┴───────┴─────┬────────────────────────────────────────────────────────┤
  2436.                       │  60h   10-Net Network                                  │
  2437.                       │  67h   Used by LIM & AQA EMS, EEMS                     │
  2438. ┌───────┬───────┬─────┴────────────────────────────────────────────────────────┤
  2439. │ 68-7F │1A0-1FF│  Reserved by IBM                                             │
  2440. └───────┴───────┴─────┬────────────────────────────────────────────────────────┤
  2441.                       │  6Ch   System Resume Vector (Convertible)              │
  2442.                       │  6Fh   some Novell and 10-Net API functions            │
  2443.                       │  70h   IRQ 8, Real Time Clock Interrupt (AT, PS/2)     │
  2444.                       │  71h   IRQ 9, LAN Adapter 1                            │
  2445.                       │  72h   IRQ 10  (AT, XT/286, PS/2)  Reserved            │
  2446.                       │  73h   IRQ 11  (AT, XT/286, PS/2)  Reserved            │
  2447.                       │  74h   IRQ 12  Mouse Interrupt (PS/2)                  │
  2448.                       │  75h   IRQ 13, Coprocessor Error                       │
  2449.                       │  76h   IRQ 14, Hard Disk Controller (AT, PS/2)         │
  2450.                       │  77h   IRQ 15 (AT, XT/286, PS/2)  Reserved             │
  2451.                       │  7Ch   IBM REXX88PC command language                   │
  2452. ┌───────┬───────┬─────┴────────────────────────────────────────────────────────┤
  2453. │ 80-85 │200-217│  ROM BASIC                                                   │
  2454. ├───────┼───────┼──────────────────────────────────────────────────────────────┤
  2455. │ 86-F0 │218-3C3│  Used by BASIC Interpreter When BASIC is running             │
  2456. ├───────┼───────┼──────────────────────────────────────────────────────────────┤
  2457. │ F1-FF │3C4-3FF│  Reserved by IBM                                             │
  2458. └───────┴───────┴──────┬───────────────────────────────────────────────────────┤
  2459.                        │ *0F8h  Set Shell Interrupt (OEM)                      │
  2460.                        │ *0F9h  OEM SHELL service codes                        │
  2461.                        └───────────────────────────────────────────────────────┘
  2462.  
  2463.  
  2464.  
  2465. The IBM-PC System Interrupts (in detail) .............................. 2**9
  2466.  
  2467. ┌─────────────────────────────────────────────────────────────────────────────┐
  2468. │Interrupt  00h Divide by Zero                                                │
  2469. └─────────────────────────────────────────────────────────────────────────────┘
  2470. (0:0000h) (processor error). Automatically called at end of DIV or IDIV
  2471.           operation that results in error. Normally set by DOS to display an
  2472.           error message and abort the program.
  2473.  
  2474. note    On an 8086/8088, the return address points to the following instruction
  2475.         On an 80286/80386, the return address points to the divide instruction
  2476.  
  2477.  
  2478. ┌─────────────────────────────────────────────────────────────────────────────┐
  2479. │Interrupt  01h Single step                                                   │
  2480. └─────────────────────────────────────────────────────────────────────────────┘
  2481. (0:0004h) Taken after every instruction when CPU Trap Flag indicates
  2482.           single-step mode (bit 8 of FLAGS is 1). This is what makes the "T"
  2483.           command of DEBUG work for single stepping. Is not generated after MOV
  2484.           to segment register or POP of segment register. (unless you have a
  2485.           very early 8088 with the microcode bug).
  2486.  
  2487.  
  2488. ┌─────────────────────────────────────────────────────────────────────────────┐
  2489. │Interrupt  02h Non-maskable interrupt                                        │
  2490. └─────────────────────────────────────────────────────────────────────────────┘
  2491. (0:0008h)       Vector not disabled via CLI. Generated by NMI signal in
  2492.                 hardware. This function is called in the event of a memory
  2493.                 parity error or may occur in the event of other hardware
  2494.                 problems or failures depending on the specific manufacturer's
  2495.                 hardware. Displays the appropriate error message and halts the
  2496.                 processor.
  2497.                  Some AT chip sets apparently use int 02h to signal I/O errors
  2498.                 as well as parity errors.
  2499.  
  2500.                 This signal has various uses:
  2501.         POST parity error:                  all except PCjr and Convertible
  2502.         80x87 coprocessor interrupt:        all except PCjr and Convertible
  2503.         Keyboard interrupt:                 PCjr, Convertible
  2504.         I/O channel check:                  Convertible, PS/2 50+
  2505.         Disk controller power-on request:   Convertible
  2506.         System suspend:                     Convertible
  2507.         Realtime clock:                     Convertible
  2508.         System watchdog timer:              PS/2 50+
  2509.         Timeout interrupt:                  PS/2 50+
  2510.         DMA timer time-out interrupt:       PS/2 50+
  2511.         Infrared keyboard link:             PCjr
  2512.  
  2513.  
  2514. ┌─────────────────────────────────────────────────────────────────────────────┐
  2515. │Interrupt  03h Breakpoint                                                    │
  2516. └─────────────────────────────────────────────────────────────────────────────┘
  2517. (0:000Ch)  Taken when CPU executes the 1-byte int 3 (0CCh). Similar to 8080's
  2518.  
  2519. (internal) RST instruction. Generally used to set breakpoints for DEBUG.
  2520.  
  2521. note 1)  Also used by Turbo Pascal versions 1,2,3 when {$U+} specified.
  2522.      2)  Int 3s are sometimes inserted by the Microsoft Linker in response to
  2523.          an unresolved symbol.
  2524.  
  2525.  
  2526. ┌─────────────────────────────────────────────────────────────────────────────┐
  2527. │Interrupt  04h Divide overflow                                               │
  2528. └─────────────────────────────────────────────────────────────────────────────┘
  2529. (0:0010h)  Generated by INTO instruction if OF flag is set. If flag is not set,
  2530.  
  2531. (internal) INTO is effectively a NOP. Used to trap any arithmetic errors when
  2532.            program is ready to handle them rather than immediately when they
  2533.            occur.
  2534.  
  2535.  
  2536. ┌─────────────────────────────────────────────────────────────────────────────┐
  2537. │Interrupt  05h Print Screen                                                  │
  2538. └─────────────────────────────────────────────────────────────────────────────┘
  2539. (0:0014h)  Service dumps the screen to the printer. Invoked by int 9 for shifted
  2540.            key 55 (PrtSc). Automatically called by keyboard scan when PrtSc key
  2541.            is pressed. Normally executes a routine to print the screen, but may
  2542.            call any routine that can safely be executed from inside the keyboard
  2543.            handler. Status and result byte are at address 0050:0000.
  2544.  
  2545. (internal) BOUND Check Failed (80286+)
  2546.            Generated by BOUND instruction when the value to be tested is less
  2547.            than the indicated lower bound or greater than the indicated upper
  2548.            bound.
  2549.  
  2550. entry   AH      05h
  2551. return  absolute address 50:0
  2552.         00h     print screen has not been called, or upon return from a call
  2553.                 there were no errors
  2554.         01h     print screen is already in progress
  2555.         0FFh    error encountered during printing
  2556. note 1) Uses BIOS services to read the screen.
  2557.      2) Output is directed to LPT1.
  2558.      3) Revectored into GRAPHICS.COM if GRAPHICS.COM is loaded.
  2559.      4) On the Tandy 1000TX this interrupt can be enabled or disabled across
  2560.         the expansion slots via a DIP switch.
  2561.  
  2562.  
  2563. ┌─────────────────────────────────────────────────────────────────────────────┐
  2564. │Interrupt  06h Reserved by IBM                                               │
  2565. └─────────────────────────────────────────────────────────────────────────────┘
  2566. (0:0018h)
  2567.         On the Tandy 1000TX this interrupt can be enabled or disabled across
  2568.         the expansion slots via a DIP switch.
  2569.  
  2570. (internal) Undefined Opcode (80286+)
  2571.  
  2572.  
  2573.  
  2574. ┌─────────────────────────────────────────────────────────────────────────────┐
  2575. │Interrupt  07h Reserved by IBM                                               │
  2576. └─────────────────────────────────────────────────────────────────────────────┘
  2577. (0:00C0h)
  2578.         On the Tandy 1000TX this interrupt can be enabled or disabled across
  2579.         the expansion slots via a DIP switch.
  2580.  
  2581. (internal) No Math Unit Available (80286+)
  2582.  
  2583. note    The 80286 and later can be programmed to generate an int 7 whenever
  2584.         an ESC instruction is encountered. This could be used to emulate an
  2585.         80x87 series coprocessor in software and be transparent to the
  2586.         application software. It could also be used to make a non-Intel
  2587.         floating point processor emulate an 80x87.
  2588.  
  2589.  
  2590.  
  2591. ┌─────────────────────────────────────────────────────────────────────────────┐
  2592. │Interrupt  08h Timer                                                         │
  2593. └─────────────────────────────────────────────────────────────────────────────┘
  2594. (0:0020h)  55ms timer "tick" issued 18.2 times per second.
  2595.  (IRQ0)    8259-1 Interrupt Controller
  2596.            Updates the system time at [0040:006C] (low word) and [0040:006E]
  2597.            (high word) and issues an int 1Ch (timer). (int 1Ch points to an
  2598.            IRET instruction unless changed by a resident program). The timer
  2599.            interrupt is given the highest maskable interrupt priority upon
  2600.            power up.
  2601.  
  2602. (internal) Double Fault (80286+ protected mode) Called when multiple exceptions
  2603.            occur on one instruction, or an exception occurs in an exception
  2604.            handler. If an exception occurs in the double fault handler, the CPU
  2605.            goes into SHUTDOWN mode (which circuitry in the PC/AT converts to a
  2606.            reset).
  2607.  
  2608. entry   AH      08h
  2609. return  absolute addresses:
  2610.         40:6C   number of interrupts since power on (4 bytes)
  2611.         40:70   number of days since power on       (1 byte)
  2612.         40:67   day counter on all products after AT
  2613.         40:40   motor control count - gets decremented and shuts off diskette
  2614.                 motor if zero
  2615.  
  2616.  
  2617.  
  2618. ┌─────────────────────────────────────────────────────────────────────────────┐
  2619. │Interrupt  09h Keyboard                                                      │
  2620. └─────────────────────────────────────────────────────────────────────────────┘
  2621. (0:0024h)  Taken whenever a key is pressed or released. This is normally a scan
  2622.  (IRQ1)    code, but may also be an ACK or NAK of a command on AT-type
  2623.            keyboards. The hardware provides the key pressed in a non-ASCII scan
  2624.            code format read at I/O port 60h. The servicer acknowledges receipt
  2625.            of the key by toggling bit 7 of port 61h. (Port 61h should be read
  2626.            first, then bit 7 ORed on, output to port 61h, then ANDed off, and
  2627.            resent to port 61h).
  2628.  
  2629.             The read key is decoded to yield an ASCII character, special
  2630.            function key (such as F1) or a control function like Left Shift Key.
  2631.            The converted ASCII character is placed into the next available
  2632.            position in the circular queue keyboard. It is put in the position
  2633.            indicated by queue tail when it will not cause the loss of earlier
  2634.            entered data. The queue head points to the oldest key pressed in the
  2635.            buffer which has not been removed from the queue (the normal process
  2636.            uses int 16h to remove keys from the queue and return the key value
  2637.            to the int 16h caller).
  2638.  
  2639.             The 16 word queue holds up to 16 keys. If the queue head equals the
  2640.             queue tail, the queue is empty. Valid keys in the queue comprise
  2641.             the upper byte scan code and the lower byte ASCII character. If the
  2642.             key pressed has no ASCII equivalent (i.e F1 to F12), the lower byte
  2643.             is zero.
  2644.  
  2645.              Toggle and shift keys are not placed in the buffer, but appear in
  2646.            the two status bytes at absolute addr. [0040:0017,18].
  2647.  
  2648.            Special key combinations will cause other events to occur:
  2649.            a) Ctrl-Alt_Del  -  Reset computer by jumping to power_on_reset
  2650.            b) Print screen  -  Call int_5_prn_scrn to print the current screen
  2651.            c) Ctrl-Break    -  Call int_1Bh control break key processor (DOS)
  2652.            d) Pause         -  Wait until an ASCII key is pressed, without
  2653.                                placing the key in the queue
  2654.  
  2655. (internal) Math Unit Protection Fault (80286+ protected mode)
  2656.  
  2657. entry   AH      09h
  2658. return  at absolute memory addresses:
  2659.         40:17   bit
  2660.                 0       right shift key depressed
  2661.                 1       left shift key depressed
  2662.                 2       control key depressed
  2663.                 3       alt key depressed
  2664.                 4       ScrollLock state has been toggled
  2665.                 5       NumLock state has been toggled
  2666.                 6       CapsLock state has been toggled
  2667.                 7       insert state is active
  2668.         40:18   bit
  2669.                 0       left control key depressed
  2670.                 1       left alt key depressed
  2671.                 2       SysReq key depressed
  2672.                 3       Pause key has been toggled
  2673.                 4       ScrollLock key is depressed
  2674.                 5       NumLock key is depressed
  2675.                 6       CapsLock key is depressed
  2676.                 7       Insert key is depressed
  2677.         40:96   bit
  2678.                 0       last code was the E1h hidden code
  2679.                 1       last code was the E0h hidden code
  2680.                 2       right control key down
  2681.                 3       right alt key down
  2682.                 4       101 key Enhanced keyboard installed
  2683.                 5       force NumLock if rd ID & kbx
  2684.                 6       last character was first ID character
  2685.                 7       doing a read ID (must be bit 0)
  2686.         40:97   bit
  2687.                 0       ScrollLock indicator
  2688.                 1       NumLock indicator
  2689.                 2       CapsLock indicator
  2690.                 3       circus system indicator
  2691.                 4       ACK received
  2692.                 5       resend received flag
  2693.                 6       mode indicator update
  2694.                 7       keyboard transmit error flag
  2695.         40:1E   keyboard buffer (20h bytes)
  2696.         40:1C   buffer tail pointer
  2697.         40:72   1234h if ctrl-alt-del pressed on keyboard
  2698.      AL   scan code
  2699. note 1) Int 05h invoked if PrtSc key pressed.
  2700.      2) Int 1Bh invoked if Ctrl-Break key sequence pressed.
  2701.      3) Int 15h, AH=85h invoked on AT and after if SysReq key is pressed.
  2702.      4) Int 15h, AH=4Fh invoked on machines after AT.
  2703.      5) Int 16h, BIOS keyboard functions, uses this interrupt.
  2704.  
  2705.  
  2706. ┌─────────────────────────────────────────────────────────────────────────────┐
  2707. │Interrupt  0Ah  EGA Vertical Retrace                                         │
  2708. └─────────────────────────────────────────────────────────────────────────────┘
  2709. (0:0028h)  used by EGA vertical retrace
  2710.  (IRQ2)    8259-1 Interrupt Controller
  2711. note 1) The TOPS and PCnet adapters use this IRQ line by default.
  2712.      2) On systems equipped with 2 interrupt controller chips (8259), IRQ 2
  2713.         is used to support the second interrupt controller. In this case,
  2714.         int 71h (IRQ 9) is used to replace IRQ 2. Hardware calls to int 71h
  2715.         are redirected to this interrupt to maintain compatibility.
  2716.      3) Many VGA boards to not use this interrupt.
  2717.  
  2718. (internal) Invalid Task State Segment (80286+ protected mode)
  2719.  
  2720.  
  2721.  
  2722. ┌─────────────────────────────────────────────────────────────────────────────┐
  2723. │Interrupt  0Bh  Communications Controller (serial port) hdw. entry           │
  2724. └─────────────────────────────────────────────────────────────────────────────┘
  2725. (0:002Ch)  Serial Port 2 (COM2) 8259-1
  2726.  (IRQ3)
  2727. note 1) IRQ 3 may be used by SDLC (synchronous data-link control) or
  2728.         bisynchronous communications cards instead of a serial port.
  2729.      2) The TOPS and PCnet adapters use this interrupt request line as an
  2730.         alternate.
  2731.      3) On PS/2s, COM2 through COM8 share this IRQ.
  2732.      4) For most serial boards, COM4 shares this IRQ.
  2733.      5) On the Commodore Amiga 2000 with the PC Bridge Board, this interrupt
  2734.         is used for communication between the Amiga system board and the
  2735.         Bridge Board. This was probably the lowest IRQ level they felt safe
  2736.         using, but limits the A2000's use of network cards, etc.
  2737.      6) This interrupt is used by part of the stack-switching code added
  2738.         to DOS 3.2 for use with Local Area Network adapters.
  2739.      7) The PS/2 puts COM3 through COM8 at port addresses above 3FFh (not
  2740.         properly decoded by older PCs) and has all of them sharing IRQ3.
  2741.  
  2742. (internal) Not Present (80286+ protected mode)
  2743.            Generated when loading a segment register if the segment descriptor
  2744.            indicates that the segment is not currently in memory. May be used
  2745.            to implement virtual memory.
  2746.  
  2747.  
  2748. ┌─────────────────────────────────────────────────────────────────────────────┐
  2749. │Interrupt  0Ch  Communications Controller (serial port) Hardware Entry       │
  2750. └─────────────────────────────────────────────────────────────────────────────┘
  2751. (0:0030h)  Serial Port 1 (COM1) or internal modem in PCjr or Convertible
  2752.  (IRQ4)    8259-1
  2753. note 1) IRQ 4 may be used by SDLC (synchronous data-link control) or
  2754.         bisynchronous communications cards instead of a serial port.
  2755.      2) On some PCs, this interrupt is shared by COM3.
  2756.      3) Tandy computers use IRQ4 instead of IRQ5 for the hard disk interrupt.
  2757.      4) Best performance of mice sometimes happens when they are configured
  2758.         for IRQ4 instead of IRQ3, since some mouse drivers may lock system
  2759.         interrupts for long periods.
  2760.  
  2761. (internal) Stack Fault (80286+ protected mode)
  2762.            Generated on stack overflow/underflow. Note that the 80286 will shut
  2763.            down in real mode if SP=1 before a push.
  2764.  
  2765.  
  2766. ┌─────────────────────────────────────────────────────────────────────────────┐
  2767. │Interrupt  0Dh  Hard Disk                                                    │
  2768. └─────────────────────────────────────────────────────────────────────────────┘
  2769. (0:0034h)  Miscelleneous uses
  2770.  (IRQ5)    8259-1
  2771. note 1) Various Tandy 1000 models may use this line for the 60Hhz RAM refresh
  2772.         or as "optional bus interrupt."
  2773.      2) Used by hard disk on IBM XT and most compatibles.
  2774.      3) LPT2 on AT, XT/286, and PS/2
  2775.      4) Dummy CRT vertical retrace on PCjr
  2776.  
  2777. (internal) General Protection Violation (80286+)
  2778.            Called in real mode when an instruction attempts to access a word
  2779.            operand located at offset 0FFFFh or a PUSH MEM or POP MEM
  2780.            instruction contains an invalid bit code in the second byte, or
  2781.            when an instruction exceeds the maximum length allowed (10 bytes
  2782.            for 80286, 15 bytes for 80386)
  2783.  
  2784.  
  2785. ┌─────────────────────────────────────────────────────────────────────────────┐
  2786. │Interrupt  0Eh  Diskette Interrupt                                           │
  2787. └─────────────────────────────────────────────────────────────────────────────┘
  2788. (0:0038h)  Generated by floppy controller on completion of an operation
  2789.  (IRQ6)    (sets bit 8 of 40:3E)
  2790.  
  2791. (internal) Page Fault (80386+ native mode)
  2792.  
  2793.  
  2794. ┌─────────────────────────────────────────────────────────────────────────────┐
  2795. │Interrupt  0Fh  Reserved by IBM                                              │
  2796. └─────────────────────────────────────────────────────────────────────────────┘
  2797. (0:003Ch)  IRQ7 used by 8259 PPI interrupt (LPT1, LPT2)
  2798.  (IRQ7)
  2799. note 1) Generated by the LPT1 printer adapter when printer becomes ready. Many
  2800.         printer adapters do not reliably generate this interrupt.
  2801.      2) This interrupt is normally avoided. If a bad interrupt occurs, it will
  2802.         vector to this spot (when caused by a misprogrammed 8259 PIC)
  2803.  
  2804.  
  2805.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  2806.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  2807. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  2808.                      ISBN 1-878830-02-3 (disk-based text)
  2809.                     Copyright (c) 1987, 1992 Dave Williams
  2810.                         ┌─────────────────────────────┐
  2811.                         │ Shareware Version, 03/16/92 │
  2812.                         │  Please Register Your Copy  │
  2813.                         └─────────────────────────────┘
  2814.  
  2815.  
  2816.                           C H A P T E R    T H R E E
  2817.  
  2818.  
  2819.                                 THE PC ROM BIOS
  2820.  
  2821.  
  2822.                                 C O N T E N T S
  2823.  
  2824. Calling the ROM BIOS .................................................. 3**1
  2825. Interrupt 10h  Video Services ......................................... 3**2
  2826. Interrupt 11h  Equipment Check ........................................ 3**3
  2827. Interrupt 12h  Memory Size ............................................ 3**4
  2828. Interrupt 13h  Disk Functions ......................................... 3**5
  2829. Interrupt 14h  Initialize and Access Serial Port ...................... 3**6
  2830.                FOSSIL Drivers ......................................... 3**7
  2831. Interrupt 15h  Cassette I/O ........................................... 3**8
  2832. Interrupt 16h  Keyboard I/O ........................................... 3**9
  2833. Interrupt 17h  Printer ................................................ 3**10
  2834. Interrupt 18h  ROM BASIC .............................................. 3**11
  2835. Interrupt 19h  Bootstrap Loader ....................................... 3**12
  2836. Interrupt 1Ah  Time of Day ............................................ 3**13
  2837. Interrupt 1Bh  Control-Break .......................................... 3**14
  2838. Interrupt 1Ch  Timer Tick ............................................. 3**15
  2839. Interrupt 1Dh  Vector of Video Initialization Parameters .............. 3**16
  2840. Interrupt 1Eh  Vector of Diskette Controller Parameters ............... 3**17
  2841. Interrupt 1Fh  Ptr to Graphics Character Extensions (Graphics Set 2) .. 3**18
  2842.  
  2843.  
  2844.  
  2845.  The ROM BIOS is the lowest level of software access. It contains the
  2846. following routines:
  2847.  
  2848.    (all)
  2849.         power-on self-test (POST)
  2850.         boostrap loader
  2851.         clock
  2852.         floppy disk I/O
  2853.         video I/O
  2854.         keyboard
  2855.         serial ports
  2856.         parallel ports
  2857.         print screen
  2858.         equipment check
  2859.         report memory size
  2860.  
  2861.  
  2862.     (AT)
  2863.         hard disk I/O
  2864.         report memory size (extended memory)
  2865.         extended memory block moves
  2866.         enhanced video and keyboard I/O
  2867.         high resolution timer
  2868.         alarm
  2869.  
  2870.   Machines such as the PC Convertible, PCjr, and non-IBM machines add
  2871. additional functions.
  2872.  
  2873.  
  2874. Calling the ROM BIOS .................................................. 3**1
  2875.  
  2876.  The BIOS services are invoked by placing the number of the desired function in
  2877. register AH, subfunction in AL, setting the other registers to any specific
  2878. requirements of the function, and invoking any of ints 10h through int 1Fh.
  2879.  
  2880.  The original IBM PC Technical Reference gave the absolute addresses of the
  2881. ROM routines. Some early software jumped directly to these addresses, with
  2882. mixed results on non-IBM BIOSes. This practice was common on machines
  2883. predating the PC, but there is no practical use for it now. The OS/2
  2884. Compatibility Box also does not support jumping directly into the ROM.
  2885.  
  2886.  When the interrupt is called, all register and flag values are pushed into the
  2887. stack. The interrupt address contains a pointer into an absolute address in the
  2888. ROM BIOS chip address space. This location may be further vectored into the
  2889. IBMBIO.COM (or equivalent) file or user file.
  2890.  
  2891.  The address vector points to a particular BIOS command handler. The handler
  2892. pops the register values, compares them to its list of functions, and executes
  2893. the function if valid. When the function is complete, it may pass values back
  2894. to the command handler. The handler will push the values into the stack and
  2895. then return control to the calling program.
  2896.  
  2897.  Most functions will return an error code; some return more information.
  2898. Details are contained in the listings for the individual functions.
  2899.  
  2900.  Register settings listed are the ones used by the BIOS. Some functions will
  2901. return with garbage values in unused registers. Do not test for values in
  2902. unspecified registers; your program may exhibit odd behavior.
  2903.  
  2904.  
  2905.  Three sets of BIOS routines are available: PC BIOS, AT BIOS (also called
  2906. CBIOS or "Old compatibility BIOS", and the PS/2 ABIOS "Advanced BIOS".
  2907.  
  2908.  The Advanced BIOS is contained in PS/2 ROMs. It is primarily intended for OS
  2909. use rather than application use. OS/2 can take advantage of ABIOS routines to
  2910. reduce RAM use on PS/2 systems. The ABIOS can be replaced by disk and RAM based
  2911. ABIOS code if desired. There is a new BIOS Data Area defined in high memory
  2912. that occupies one K of RAM. In OS/2 systems, parts of the ABIOS are replaced
  2913. by OS/2 drivers.
  2914.  
  2915.  While the CBIOS must be addressed via pointers, the routines in the ABIOS are
  2916. fixed in absolute locations so they can be referenced directly by OS/2.
  2917.  
  2918.  The ABIOS can run in protected mode, and is fully reentrant. It supports three
  2919. types of function requests - single staged, discrete multistaged, or continuous
  2920. multistaged. A single-staged request does its job immediately and returns
  2921. control to the caller. A discrete multistaged request may happen in two or more
  2922. stages with pauses between the stages. The caller may regain control during the
  2923. pauses. A continuous multistaged request starts a staged operation that never
  2924. ends. (sometimes called a daemon).
  2925.  
  2926.  Unlike the CBIOS which is called with software interrupts, ABIOS is accessed
  2927. with FAR calls. ABIOS calls are completely reentrant in both real and
  2928. protected modes. To call an ABIOS function, the calling program must pass
  2929. pointers to two data structures - a request block and a common data area. The
  2930. request block specifies the desired function number and the common data area is
  2931. a table that contains pointers to all the ABIOS' other tables and data areas.
  2932. The common data area's internal structure contains the function transfer
  2933. tables which have the addresses of the BIOS routines.
  2934.  
  2935. ABIOS stack frame and calling conventions:
  2936.        bytes        stack contents
  2937.         2       common data area pointer (segment/selector only) required
  2938.         4       request block pointer - required
  2939.         4       function transfer table pointer - furnished by ABIOS or caller
  2940.         4       device block pointer - furnished by ABIOS or caller
  2941.         4       return address
  2942.  
  2943.  In ABIOS Transfer Convention, only the first two items are required. ABIOS
  2944. assigns the second two. In Operating System Transfer Convention, the caller
  2945. provides the second two. Since the parameters are not removed from the stack
  2946. on return to the caller, the operating system may save the function transfer
  2947. table and device addresses after they have been furnished by the ABIOS by a
  2948. call.
  2949.  
  2950.  ABIOS does no interrupt arbitration. It assumes all interrupts are handled by
  2951. the caller or the OS and it is called only for service. If more than one
  2952. device is sharing a hardware interrupt, the OS must determine which interrupt
  2953. is valid for the ABIOS.
  2954.  
  2955.  OS/2 may use the ABIOS if found, but otherwise duplicates the BIOS calls for
  2956. the DOS Compatibility Box by vectoring BIOS calls into its own device drivers.
  2957. This makes it rather difficult for DOS drivers for mass storage, high
  2958. resolution video boards, multitasking APIs using int 15h, etc. If your
  2959. software needs to manipulate hardware directly you might want to check if your
  2960. code is running under OS/2. The simplest method is to check for DOS version 10
  2961. or higher.
  2962.  
  2963.  
  2964. note    Some references list an "XT/2" machine, which was reputedly an 8mHz
  2965.         8088 with 640k and a clock on the motherboard. IBM doesn't list such
  2966.         a machine, and I have a late '86 XT, one of the last made. It is
  2967.         pretty much like the older ones.
  2968.  
  2969.  
  2970. ┌─────────────────────────────────────────────────────────────────────────────┐
  2971. │Interrupt 10h  Video Services                                          3**2  │
  2972. └─────────────────────────────────────────────────────────────────────────────┘
  2973. (0:0040h)       The BIOS Video Services may be found in Chapter 16.
  2974.  
  2975. (internal) Coprocessor Error (80286+)
  2976.         Generated by the CPU when the -ERROR pin is asserted by the coprocessor
  2977.         (usually 80x87, but may be any multimaster CPU or alternate NDP such
  2978.         as Weitek, etc.). ATs and clones usually wire the coprocessor to use
  2979.         IRQ13, but not all get it right.
  2980.  
  2981.  
  2982.  
  2983. ┌─────────────────────────────────────────────────────────────────────────────┐
  2984. │Interrupt 11h  Equipment Check                                         3**3  │
  2985. └─────────────────────────────────────────────────────────────────────────────┘
  2986. (0:0044h)       Reads the BIOS Data Area and returns two bytes of setup info.
  2987. entry   no parameters are required
  2988. return  AX      Equipment listing word. Bits are:
  2989.                 0       number of floppy drives
  2990.                         0       no drives
  2991.                         1       bootable (IPL) diskette drive installed
  2992.                 1       math chip
  2993.                         0       no math coprocessor (80x87) present
  2994.                         1       math coprocessor (80x87) present
  2995.          (PS/2) 2       0       mouse not installed
  2996.                         1       mouse installed
  2997.           (PC)  2,3     system board RAM
  2998.                         0,0     16k    (PC-0, PC-1)
  2999.                         0,1     32k
  3000.                         1,0     48k
  3001.                         1,1     64k    (PC-2, XT)
  3002.                         note 1) not commonly used. Set both bits to 1
  3003.                              2) both bits always 1 in AT
  3004.                 4,5     initial video mode
  3005.                         0,0     no video installed (use with dumb terminal)
  3006.                         0,1     40x25 color      (CGA)
  3007.                         1,0     80x25 color      (CGA, EGA, PGA, MCGA, VGA)
  3008.                         1,1     80x25 monochrome (MDA or Hercules, most super-
  3009.                                                   hires mono systems)
  3010.                 6,7     number of diskette drives (only if bit 0 is 1)
  3011.                         0,0     1 drives
  3012.                         0,1     2 drives
  3013.                         1,0     3 drives
  3014.                         1,1     4 drives
  3015.                 8       0       DMA present
  3016.                         1       no DMA (PCjr, some Tandy 1000s, 1400LT)
  3017.                 9,A,B   number of RS232 serial ports (0-3)
  3018.                         0,0,0   none
  3019.                         0,0,1   1
  3020.                         0,1,0   2
  3021.                         0,1,1   3
  3022.                         1,0,0   4
  3023.                 C       0       no game I/O attached
  3024.                         1       game I/O attached (default for PCjr)
  3025.                 D       serial accessory installation
  3026.                         0       no serial accessories installed
  3027.                         1       Convertible - internal modem installed
  3028.                                 or PCjr - serial printer attached
  3029.                 E,F     number of parallel printers
  3030.                         0,0     none
  3031.                         0,1     one   (LPT1, PRN)
  3032.                         1,0     two   (LPT2)
  3033.                         1,1     three (LPT3)
  3034.                         note    Models before PS/2 would allow a fourth
  3035.                                 parallel printer. Remapping of the BIOS in the
  3036.                                 PS/2s does not allow the use of LPT4.
  3037.         (386 extended AX)
  3038.                 23d     0       Weitek ABACUS - virtual '86 EMS page tables
  3039.                                 not correctly initialized
  3040.                         1       Weitek ABACUS - virtual '86 EMS page tables OK
  3041.  
  3042.                 24d     0       Weitek ABACUS NDP not present
  3043.                         1       Weitek ABACUS NDP present
  3044.  
  3045.  
  3046.  
  3047.  
  3048. ┌─────────────────────────────────────────────────────────────────────────────┐
  3049. │Interrupt 12h  Memory Size                                             3**4  │
  3050. └─────────────────────────────────────────────────────────────────────────────┘
  3051. (0:0048h)       get system memory
  3052. entry   no parameters required
  3053. return  AX      number of contiguous 1K RAM blocks available for DOS
  3054. note 1) This is the same value stored in absolute address 04:13h.
  3055.      2) For some early PC models, the amount of memory returned by this call is
  3056.         determined by the settings of the dip switches on the motherboard and
  3057.         may not reflect all the memory that is physically present.
  3058.      3) For the PC/AT, the value returned is the amount of functional memory
  3059.         found during the power-on self-test, regardless of the memory size
  3060.         configuration information stored in CMOS RAM.
  3061.      4) The value returned does not reflect any extended memory (above the 1 Mb
  3062.         boundary) that may be present on 80286 or 80386 machines.
  3063.  
  3064.  
  3065.  
  3066.  
  3067. ┌─────────────────────────────────────────────────────────────────────────────┐
  3068. │Interrupt 13h  Disk Functions                                          3**5  │
  3069. └─────────────────────────────────────────────────────────────────────────────┘
  3070. (0:0049h)       The service calls for BIOS disk functions are located in
  3071.                 Chapter 8.
  3072.  
  3073.  
  3074.  
  3075.  
  3076. ┌─────────────────────────────────────────────────────────────────────────────┐
  3077. │Interrupt 14h  Initialize and Access Serial Port For Int 14            3**6  │
  3078. └─────────────────────────────────────────────────────────────────────────────┘
  3079.  Note:  Some IBM PS/2 Model 50Z machines were delivered with serial ports
  3080.         that did not meet specification.  Some cheap clone serial ports may
  3081.         also be troublesome.
  3082.  
  3083. (0:0050h)       the following status is defined:
  3084.  
  3085.         serial status byte:
  3086.         bits    0 delta clear to send
  3087.                 1 delta data set ready
  3088.                 2 trailing edge ring detector
  3089.                 3 delta receive line signal detect
  3090.                 4 clear to send
  3091.                 5 data set ready
  3092.                 6 ring indicator
  3093.                 7 receive line signal detect
  3094.  
  3095.         line status byte:
  3096.         bits    0 data ready
  3097.                 1 overrun error
  3098.                 2 parity error
  3099.                 3 framing error
  3100.                 4 break detect
  3101.                 5 transmit holding register empty
  3102.                 6 transmit shift register empty
  3103.                 7 time out  note: if bit 7 set then other bits are invalid
  3104.  
  3105.         Though present on the IBM PS/2s, COM3 and COM4 are not widely
  3106.         standardized across the industry. The most common definitions are:
  3107.  
  3108.         port    addr.   IRQ     interrupt
  3109.  
  3110.         COM1    3F8     IRQ4    int 0Ch
  3111.         COM2    2F8     IRQ3    int 0Bh
  3112.         COM3    3E8     IRQ4    int 0Ch
  3113.         COM4    2E8     IRQ3    int 0Bh
  3114.  
  3115.         As you can see, COM1/COM3 and COM2/COM4 are siamesed.  Since the ISA
  3116.         bus does not support shared interrupts, simultaneous access of two of
  3117.         a pair may cause conflict.  For example, a mouse and a modem would not
  3118.         coexist well on paired ports.
  3119.  
  3120.  
  3121.  All routines have AH=function number and DX=RS232 card number (0 based).
  3122. AL=character to send or received character on exit, unless otherwise noted.
  3123.  
  3124. entry   AH      00h     Initialize And Access Serial Communications Port
  3125.                         bit pattern: BBBPPSLL
  3126.                         BBB = baud rate:   110,150,300,600,1200,2400,4800,9600
  3127.                         PP  = parity:      01 = odd, 11 = even
  3128.                         S   = stop bits:   0 = 1, 1 = 2
  3129.                         LL  = word length: 10 = 7-bits, 11 = 8-bits
  3130.         AL      parms for initialization:
  3131.                 bit pattern:
  3132.                 0       word length
  3133.                 1       word length
  3134.                 2       stop bits
  3135.                 3       parity
  3136.                 4       parity
  3137.                 5       baud rate
  3138.                 6       baud rate
  3139.                 7       baud rate
  3140.                 word length     10      7 bits
  3141.                                 11      8 bits
  3142.                 stop bits       0       1 stop bit
  3143.                                 1       2 stop bits
  3144.                 parity          00      none
  3145.                                 01      odd
  3146.                                 11      even
  3147.                 baud rate       000     110 baud
  3148.                                 001     150 baud
  3149.                                 010     300 baud
  3150.                                 011     600 baud
  3151.                                 100     1200 baud
  3152.                                 101     2400 baud
  3153.                                 110     4800 baud
  3154.                                 111     9600 baud  (4800 on PCjr)
  3155.         DX      port number (0=COM1, 1=COM2, etc.)
  3156. return  AH      line status
  3157.         AL      modem status
  3158. note    To initialize the serial port to > 9600 baud on PS/2 machines, see
  3159.         fns 04h and 05h.
  3160.  
  3161.  
  3162. Function 01h    Send Character in AL to Comm Port
  3163. entry   AH      01h
  3164.         AL      character
  3165.         DX      port number (0 - 3)
  3166. return  AH      RS232 status code
  3167.                 bit     0       data ready
  3168.                         1       overrun error
  3169.                         2       parity error
  3170.                         3       framing error
  3171.                         4       break detected
  3172.                         5       transmission buffer register empty
  3173.                         6       transmission shift register empty
  3174.                         7       timeout
  3175.         AL      modem status
  3176.                 bit
  3177.                         0       delta clear-to-send
  3178.                         1       delta data-set-ready
  3179.                         2       trailing edge ring detected
  3180.                         3       change, receive line signal detected
  3181.                         4       clear-to-send
  3182.                         5       data-set-ready
  3183.                         6       ring received
  3184.                         7       receive line signal detected
  3185.  
  3186.  
  3187. Function 02h    Wait For A Character From Comm Port DX
  3188. entry   AH      02h
  3189.         DX      port number (0-3)
  3190. return  AL      character received
  3191.         AH      error code (see above)(00h for no error)
  3192.  
  3193.  
  3194. Function 03h    Fetch the Status of Comm Port DX (0 or 1)
  3195. entry   AH      03h
  3196.         DX      port (0-3)
  3197. return  AH      set bits (01h) indicate comm-line status
  3198.                 bit     7       timeout
  3199.                 bit     6       empty transmit shift register
  3200.                 bit     5       empty transmit holding register
  3201.                 bit     4       break detected ("long-space")
  3202.                 bit     3       framing error
  3203.                 bit     2       parity error
  3204.                 bit     1       overrun error
  3205.                 bit     0       data ready
  3206.         AL      set bits indicate modem status
  3207.                 bit     7       received line signal detect
  3208.                 bit     6       ring indicator
  3209.                 bit     5       data set ready
  3210.                 bit     4       clear to send
  3211.                 bit     3       delta receive line signal detect
  3212.                 bit     2       trailing edge ring detector
  3213.                 bit     1       delta data set ready
  3214.                 bit     0       delta clear to send
  3215.  
  3216.  
  3217. Function 04h    Extended Initialize                       (Convertible, PS/2)
  3218. entry   AH      04h
  3219.         AL      break status
  3220.                 01h     if break
  3221.                 00h     if no break
  3222.         BH      parity
  3223.                 00h     no parity
  3224.                 01h     odd parity
  3225.                 02h     even parity
  3226.                 03h     stick parity odd
  3227.                 04h     stick parity even
  3228.         BL      number of stop bits
  3229.                 00h     one stop bit
  3230.                 01h     2 stop bits (1½ if 5 bit word length)
  3231.         CH      word length
  3232.                 00h     5 bits
  3233.                 01h     6 bits
  3234.                 02h     7 bits
  3235.                 03h     8 bits
  3236.         CL      baud rate
  3237.                 00h     110
  3238.                 01h     150
  3239.                 02h     300
  3240.                 03h     600
  3241.                 04h     1200
  3242.                 05h     2400
  3243.                 06h     4800
  3244.                 07h     9600
  3245.                 08h     19200
  3246.         DX      comm port (0-3)
  3247. return  AH      line control status
  3248.         AL      modem status
  3249. note    Provides a superset of fn 00h capabilities for PS/2 machines.
  3250.  
  3251.  
  3252. Function 05h    Extended Communication Port Control       (Convertible, PS/2)
  3253. entry   AH      05h
  3254.         AL      00h     read modem control register
  3255.                 01h     write modem control register
  3256.         BL      modem control register
  3257.            bits 0       DTR data terminal ready
  3258.                 1       RTS request to send
  3259.                 2       out1
  3260.                 3       out2
  3261.                 4       loop
  3262.                 5,6,7   reserved
  3263.         DX      port number (0=COM1, 1=COM2, etc.)
  3264. return  AH      port status (see 00h above)
  3265.         AL      modem status (see 00h above)
  3266.         BL      modem control register (see 01h above)
  3267.  
  3268.  
  3269.  
  3270. FOSSIL Drivers ........................................................ 3**7
  3271.  
  3272. Interrupt  14h  FOSSIL (Fido/Opus/Seadog Standard Interface Level) drivers
  3273.                 A FOSSIL is a device driver for handling the IBM PC serial
  3274.                 communications ports in a standard fashion from an application
  3275.                 (communications) program. A FOSSIL chains into the int 14h BIOS
  3276.                 communications vector and replaces many functions with enhanced
  3277.                 routines that may be easily accessed by an application.
  3278.  
  3279.                 For all functions, all registers not specifically containing a
  3280.                 function return value must be preserved across the call.
  3281.  
  3282.  
  3283. entry   AH      00h     Set baud rate and parameters
  3284.         AL      byte
  3285.                 bits 7,6,5 baudrate
  3286.                 000     19200 baud
  3287.                 001     38400 baud
  3288.                 010     300 baud
  3289.                 011     600 baud
  3290.                 100     1200 baud
  3291.                 101     2400 baud
  3292.                 110     4800 baud
  3293.                 111     9600 baud
  3294.                 bits 4,3 parity
  3295.                 00      none
  3296.                 01      odd
  3297.                 10      none
  3298.                 11      even
  3299.                 bit 2 stop bits
  3300.                 0       1 stop bit
  3301.                 1       2 stop bits
  3302.                 bit 1 char length
  3303.                 0       5 bits plus value
  3304.                 other   optional
  3305.         DX      port number (NOP if DX=00FFh)
  3306. return  AX      status (see fn 03h)
  3307. note    Low-order 5 bits are undefined by FOSSIL 1.0 spec.
  3308.  
  3309.  
  3310. entry   AH      01h     Transmit character with wait
  3311.         AL      ASCII value of character to be sent
  3312.         DX      port number (NOP if DX=00FFh)
  3313. return  AX      status bits (see function 03h)
  3314. note 1) Character is queued for transmission. If there is room in the
  3315.         transmitter buffer when this call is made, the character will be stored
  3316.         and control returned to caller. If the buffer is full, the driver will
  3317.         wait for room. Use this function with caution when flow control is
  3318.         enabled.
  3319.  
  3320.  
  3321. entry   AH      02h     FOSSIL: Receive a character with wait
  3322.         DX      port number (0-3) (NOP if DX=00FFh)
  3323. return  AH      RS-232 status code (see AH=00h above)
  3324.         AL      ASCII value of character received from serial port
  3325. note    Will timeout if DSR is not asserted, even if function 03h returns
  3326.         data ready.
  3327.  
  3328.  
  3329. entry   AH      03h     FOSSIL: Request status
  3330.         DX      port number  (NOP if DX=00FFh)
  3331. return  AX      status bit mask
  3332.                 AH      bit 0 set  RDA     input data is available in buffer
  3333.                             1 set  OVRN    input buffer overrun
  3334.                             2 N/A
  3335.                             3 N/A
  3336.                             4 N/A
  3337.                             5 set  THRE    room is available in output buffer
  3338.                             6 set  TSRE    output buffer is empty
  3339.                             7 N/A
  3340.                 AL      bit 0 N/A
  3341.                             1 N/A
  3342.                             2 N/A
  3343.                             3 set          this bit is always set
  3344.                             4 N/A
  3345.                             5 N/A
  3346.                             6 N/A
  3347.                             7 set  DCD     carrier detect
  3348. note    Bit 3 of AL is always returned set to enable programs to use it as a
  3349.         carrier detect bit on hardwired (null modem) links.
  3350.  
  3351.  
  3352. entry   AH      04h     Initialize FOSSIL driver
  3353.         BX      4F50h                      (optional)
  3354.         DX      port number                (DX=00FFh special)
  3355.         ES:CX   pointer to ^C flag address (optional)
  3356. return  AX      1954h if successful
  3357.         BL      maximum function number supported (excluding 7Eh-0BFh)
  3358.         BH      revision of FOSSIL supported
  3359. note 1) DTR is raised when FOSSIL inits.
  3360.      2) Existing baudrate is preserved.
  3361.      3) If BX contains 4F50h, the address specified in ES:CX is that of a ^C
  3362.         flag byte in the application program, to be incremented when ^C is
  3363.         detected in the keyboard service routines. This is an optional service
  3364.         and only need be supported on machines where the keyboard service can't
  3365.         (or won't) perform an int 1Bh or int 23h when a control-C is entered.
  3366.  
  3367.  
  3368. entry   AH      05h     Deinitialize FOSSIL driver
  3369.         DX      port number  (DX=00FFh special)
  3370. return  none
  3371. note 1) DTR is not affected.
  3372.      2) Disengages driver from comm port. Should be done when operations on the
  3373.         port are complete.
  3374.      3) If DX=00FFh, the initialization that was performed when FOSSIL function
  3375.         04h with DX=00FFh should be undone.
  3376.  
  3377.  
  3378. entry   AH      06h     FOSSIL: Raise/lower DTR
  3379.         AL      DTR state to be set
  3380.                 00h     lower DTR
  3381.                 01h     raise DTR
  3382.         DX      comm port (NOP if DX=00FFh)
  3383. return  none
  3384.  
  3385.  
  3386. entry   AH      07h     FOSSIL: Return timer tick parameters
  3387. return  AH      ticks per second on interrupt number shown in AL
  3388.         AL      timer tick interrupt number (not vector!)
  3389.         DX      milliseconds per tick (approximate)
  3390.  
  3391.  
  3392. entry   AH      08h     FOSSIL: Flush output buffer
  3393.         DX      port number (NOP if DX=00FFh)
  3394. return  none
  3395. note    Waits until all output is done.
  3396.  
  3397.  
  3398. entry   AH      09h     FOSSIL: Purge output buffer
  3399.         DX      port number (NOP if DX=00FFh)
  3400. return  none
  3401. note    Returns to caller immediately.
  3402.  
  3403.  
  3404. entry   AH      0Ah     FOSSIL: Purge input buffer
  3405.         DX      port number (NOP if DX=00FFh)
  3406. return  none
  3407. note 1) If any flow control restraint has been employed (dropping RTS or
  3408.         transmitting XOFF) the port will be "released" by doing the reverse,
  3409.         raising RTS or sending XON.
  3410.      2) Returns to caller immediately.
  3411.  
  3412.  
  3413. entry   AH      0Bh     FOSSIL: Transmit no wait
  3414.         AL      ASCII character value to be sent
  3415.         DX      port number (NOP if DX=00FFh)
  3416. return  AX      0000h   character not accepted
  3417.                 0001h   character accepted
  3418. note    This is exactly the same as the "regular" transmit call except that if
  3419.         there is no space available in the output buffer a value of zero is
  3420.         returned in AX, if room is available a value 1 (one) is returned.
  3421.  
  3422.  
  3423. entry   AH      0Ch     FOSSIL: Nondestructive Read no Wait
  3424.         DX      port number (NOP if DX=00FFh)
  3425. return  AH      character
  3426.                 0FFFFh  character not available
  3427. note 1) Reads async buffer.
  3428.      2) Does not remove keycode from buffer.
  3429.  
  3430.  
  3431. entry   AH      0Dh     FOSSIL: Keyboard read no wait
  3432. return  AX      IBM keyboard scan code or
  3433.                 0FFFFh if no keyboard character available
  3434. note 1) Use IBM-style function key mapping in the high order byte.
  3435.      2) Scan codes for non function keys are not specifically required but may
  3436.         be included.
  3437.      3) Does not remove keycode from buffer.
  3438.  
  3439.  
  3440. entry   AH      0Eh     FOSSIL: Keyboard input with wait
  3441. return  AX      IBM keyboard scan code
  3442. note    Returns the next character from the keyboard or waits if no character
  3443.         is available.
  3444.  
  3445.  
  3446. entry   AH      0Fh     Enable or Disable flow control
  3447.         AL      bit mask describing requested flow control
  3448.            bits 0       XON/XOFF on transmit (watch for XOFF while sending)
  3449.                 1       CTS/RTS (CTS on transmit/RTS on receive)
  3450.                 2       reserved
  3451.                 3       XON/XOFF on receive (send XOFF when buffer near full)
  3452.                 4-7     not used, FOSSIL spec calls for setting to 1
  3453.         DX      port number (NOP if DX=00FFh)
  3454. return  none
  3455. note 1) Bit 2 is reserved for DSR/DTR,  but is not currently supported in any
  3456.         implementation.
  3457.      2) TRANSMIT flow control allows the other end to restrain the transmitter
  3458.         when you are overrunning it. RECEIVE flow control tells the FOSSIL to
  3459.         attempt to do just that if it is being overwhelmed.
  3460.      3) Enabling transmit Xon/Xoff will cause the FOSSIL to stop transmitting
  3461.         upon receiving an Xoff. The FOSSIL will resume transmitting when an Xon
  3462.         is received.
  3463.      4) Enabling CTS/RTS will cause the FOSSIL to cease transmitting when CTS
  3464.         is lowered. Transmission will resume when CTS is raised. The FOSSIL
  3465.         will drop RTS when the receive buffer reaches a predetermined
  3466.         percentage full. The FOSSIL will raise RTS when the receive buffer
  3467.         empties below the predetermined percentage full. The point(s) at which
  3468.         this occurs is left to the individual FOSSIL implementor.
  3469.      5) Enabling receive Xon/Xoff will cause the FOSSIL to send a Xoff when the
  3470.         receive buffer reaches a pre-determined percentage full. An Xon will be
  3471.         sent when the receive buffer empties below the predetermined percentage
  3472.         full. The point(s) at which this occurs is left to the individual
  3473.         FOSSIL implementor.
  3474.      6) Applications using this function should set all bits ON in the high
  3475.         nibble of AL as well. There is a compatible (but not identical) FOSSIL
  3476.         driver implementation that uses the high nibble as a control mask. If
  3477.         your application sets the high nibble to all ones, it will always work,
  3478.         regardless of the method used by any given driver.
  3479.  
  3480.  
  3481. entry   AH      10h     Extended Ctrl-C/Ctrl-K checking and transmit on/off
  3482.         AL      flags bit mask byte (bit set if activated)
  3483.            bits 0       enable/disable Ctrl-C/Ctrl-K checking
  3484.                 1       disable/enable the transmitter
  3485.                 2-7     not used
  3486.         DX      port number (NOP if DX=00FFh)
  3487. return  AX      status byte
  3488.                 0000h   control-C/K has not been received
  3489.                 0001h   control-C/K has been received
  3490. note    This is used primarily for programs that can't trust XON/XOFF at FOSSIL
  3491.         level (such as BBS software).
  3492.  
  3493.  
  3494. entry   AH      11h     FOSSIL: Set current cursor location.
  3495.         DH      row (line) 0-24
  3496.         DL      column     0-79
  3497. return  none
  3498. note 1) This function looks exactly like the int 10h, fn 02h on the IBM PC.
  3499.         The cursor location is passed in DX: row in DH and column in DL. This
  3500.         function treats the screen as a coordinate system whose origin (0,0) is
  3501.         the upper left hand corner of the screen.
  3502.      2) Row and column start at 0.
  3503.  
  3504.  
  3505. entry   AH      12h     FOSSIL: Read current cursor location.
  3506. return  DH      row (line)
  3507.         DL      column
  3508. note 1) Looks exactly like int 10h/fn 03h in the IBM PC BIOS. The current
  3509.         cursor location (same coordinate system as function 16h) is passed back
  3510.         in DX.
  3511.      2) Row and column start at 0.
  3512.  
  3513.  
  3514. entry   AH      13h     FOSSIL: Single character ANSI write to screen.
  3515.         AL      value of character to display
  3516. return  none
  3517. note    This call might not be reentrant since ANSI processing may be through
  3518.         DOS.
  3519.  
  3520.  
  3521. entry   AH      14h     FOSSIL: Enable or disable watchdog processing
  3522.         AL      00h     to disable watchdog
  3523.                 01h     to enable watchdog
  3524.         DX      port number (NOP if DX=00FFh)
  3525. return  none
  3526. note 1) This call will cause the FOSSIL to reboot the system if Carrier Detect
  3527.         for the specified port drops while watchdog is turned on.
  3528.      2) The port need not be active for this function to work.
  3529.  
  3530.  
  3531. entry   AH      15h     Write character to screen using BIOS support routines
  3532.         AL      ASCII code of character to display
  3533. return  none
  3534. note 1) This function is reentrant.
  3535.      2) ANSI processing may not be assumed.
  3536.  
  3537.  
  3538. entry   AH      16h     Insert or Delete a function from the timer tick chain
  3539.         AL      00h     to delete a function
  3540.                 01h     to add a function
  3541.         ES:DX   address of function
  3542. return  AX      0000h   successful
  3543.                 0FFFFh  unsuccessful
  3544.  
  3545.  
  3546. entry   AH      17h     FOSSIL: Reboot system
  3547.         AL      boot type
  3548.                 00h     cold boot
  3549.                 01h     warm boot
  3550. return  none
  3551.  
  3552.  
  3553. entry   AH      18h     FOSSIL: Read block
  3554.         CX      maximum number of characters to transfer
  3555.         DX      port number (NOP if DX=00FFh)
  3556.         ES:DI   pointer to user buffer
  3557. return  AX      number of characters transferred
  3558. note 1) This function does not wait for more characters to become available if
  3559.         the value in CX exceeds the number of characters currently stored.
  3560.      2) ES:DI are left unchanged by the call; the count of bytes actually
  3561.         transferred will be returned in AX.
  3562.  
  3563.  
  3564. entry   AH      19h     FOSSIL: Write block
  3565.         CX      maximum number of characters to transfer
  3566.         DX      port number  (NOP if DX=00FFh)
  3567.         ES:DI   pointer to user buffer
  3568. return  AX      number of characters transfered
  3569. note    ES and DI are not modified by this call.
  3570.  
  3571.  
  3572. entry   AH      1Ah     FOSSIL: Break signal begin or end
  3573.         AL      00h     stop sending 'break'
  3574.                 01h     start sending 'break'
  3575.         DX      port number  (NOP if DX=00FFh)
  3576. return  none
  3577. note 1) Resets all transmit flow control restraints such as an XOFF received
  3578.         from remote.
  3579.      2) Init (fn 04h) or UnInit (fn 05h) will stop an in-progress break.
  3580.      3) The application must determine the "length" of the break.
  3581.  
  3582.  
  3583. entry   AH      1Bh     FOSSIL: Return information about the driver
  3584.         CX      size of user buffer in bytes
  3585.         DX      port number  (if DX=00FFh, port data will not be valid)
  3586.         ES:DI   pointer to user buffer
  3587. return  AX      number of characters transferred
  3588.         ES:DI   user buffer structure:
  3589.                 00h     word    size of structure in bytes
  3590.                 02h     byte    FOSSIL driver version
  3591.                 03h     byte    revision level of this specific driver
  3592.                 04h     dword   FAR pointer to ASCII ID string
  3593.                 08h     word    size of the input buffer in bytes
  3594.                 0Ah     word    number of bytes in input buffer
  3595.                 0Ch     word    size of the output buffer in bytes
  3596.                 0Eh     word    number of bytes in output buffer
  3597.                 10h     byte    width of screen in characters
  3598.                 11h     byte    screen height in characters
  3599.                 12h     byte    actual baud rate, computer to modem
  3600.                                 (see mask in function 00h
  3601. note 1) The baud rate byte contains the bits that fn 00h would use to set the
  3602.         port to that speed.
  3603.      2) The fields related to a particular port (buffer size, space left in the
  3604.         buffer, baud rate) will be undefined if port=0FFh or an invalid port is
  3605.         contained in DX.
  3606.      3) Additional information will always be passed after these, so that the
  3607.         fields will never change with FOSSIL revision changes.
  3608.  
  3609.  
  3610. entry   AH      7Eh     FOSSIL: Install an external application function
  3611.         AL      code assigned to external application
  3612.         ES:DX   pointer to entry point
  3613. return  AX      1954h   FOSSIL driver present
  3614.             not 1954h   FOSSIL driver not present
  3615.         BH      00h     failed
  3616.                 01h     successful
  3617.         BL      code assigned to application (same as input AL)
  3618. note 1) Application codes 80h-0BFh are supported. Codes 80h-83h are reserved.
  3619.      2) An error code of BH=00h with AX=1954h should mean that another external
  3620.         application has already been installed with the code specified in AL.
  3621.      3) Applications are entered via a FAR call and should make a FAR return.
  3622.  
  3623.  
  3624. entry   AH      7Fh     FOSSIL: Remove an external application function
  3625.         AL      code assigned to external application
  3626.         ES:DX   pointer to entry point
  3627. return  AX      1954h
  3628.         BH      00h     failed
  3629.                 01h     successful
  3630.         BL      code assigned to application (same as input AL)
  3631.  
  3632.  
  3633.  
  3634. ┌─────────────────────────────────────────────────────────────────────────────┐
  3635. │Interrupt 15h  Cassette I/O                                            3**8  │
  3636. └─────────────────────────────────────────────────────────────────────────────┘
  3637. (0:0054h)    1) Renamed "System Services" on PS/2 line.
  3638.              2) Issuing int 15h on an XT may cause a system crash.
  3639.                 On AT and after, interrupts are disabled with CLI when the
  3640.                 interrupt service routine is called, but most ROM versions do
  3641.                 not restore interrupts with STI.
  3642.              3) For the original IBM PC, int 15h returns AH=80h and CF set for
  3643.                 all calls with AH not 0,1, or 2.
  3644.              4) For the PC/XT int 15h returns AH=86h, CF set if called at all.
  3645.                 (the PC/XT ROM BIOS does not support int 15h)
  3646.              5) For the AT/339, int 15h returns AH=86h, CF set if called with
  3647.                 an invalid function code.
  3648.  
  3649.  
  3650. Function 00h    Turn Cassette Motor On                          (PC, PCjr only)
  3651. entry   AH      00h
  3652. return  CF      set on error
  3653.                 AH      error code
  3654.                         00h     no errors
  3655.                         01h     CRC error
  3656.                         02h     bad tape signals
  3657.                                 no data transitions (PCjr)
  3658.                         03h     no data found on tape
  3659.                                 not used (PCjr)
  3660.                         04h     no data
  3661.                                 no leader (PCjr)
  3662.                         80h     invalid command
  3663.                         86h     no cassette present
  3664.                                 not valid in PCjr
  3665. note    NOP for systems where cassette not supported.
  3666.  
  3667.  
  3668. Function 01h    Turn Cassette Motor Off                         (PC, PCjr only)
  3669. entry   AH      01h
  3670. return  CF      set on error
  3671.         AH      error code (86h)
  3672. note    NOP for systems where cassette not supported.
  3673.  
  3674.  
  3675. Function 02h    Read Blocks From Cassette                       (PC, PCjr only)
  3676. entry   AH      02h
  3677.         CX      number of bytes to read
  3678.         ES:BX   segment:offset + 1 of last byte read
  3679. return  CF      set on error
  3680.                 AH      error code (01h, 02h, 04h, 80h, 86h)
  3681.         DX      count of bytes actually read
  3682.         ES:BX   pointer past last byte written
  3683. note 1) NOP for systems where cassette not supported.
  3684.      2) Cassette operations normally read 256 byte blocks.
  3685.  
  3686.  
  3687. Function 03h    Write Data Blocks to Cassette                   (PC, PCjr only)
  3688. entry   AH      03h
  3689.         CX      count of bytes to write
  3690.         ES:BX   pointer to data buffer
  3691. return  CF      set on error
  3692.                 AH      error code (80h, 86h)
  3693.         CX      00h
  3694.         ES:BX   pointer to last byte written+1
  3695. note 1) NOP for systems where cassette not supported.
  3696.      2) The last block is padded to 256 bytes with zeroes if needed.
  3697.      3) No errors are returned by this service.
  3698.  
  3699.  
  3700. Function 0Fh    ESDI Format Unit Periodic Interrupt          (PS/2 50+)
  3701. entry   AH      0Fh
  3702.         AL      phase code
  3703.                 00h     reserved
  3704.                 01h     surface analysis
  3705.                 02h     formatting
  3706. return  CF      clear   if formatting should continue
  3707.                 set     if it should terminate
  3708. note 1) Called the BIOS on the ESDI Fixed Disk Drive Adapter/A during a format
  3709.         or surface analysis operation after each cylinder is completed.
  3710.      2) This function call can be captured by a program so that it will be
  3711.         notified as each cylinder is formatted or analyzed. The program can
  3712.         count interrupts for each phase to determine the current cylinder
  3713.         number.
  3714.      3) The BIOS default handler for this function returns with CF set.
  3715.  
  3716.  
  3717. Function 10h    TopView API Function Calls                      (TopView)
  3718.                 see Chapter 17
  3719.  
  3720.  
  3721. Function 20h    PRINT.COM  (DOS 3.1+ internal)         (AT, XT/286, PS/2 50+)
  3722. entry   AH      20h
  3723.         AL      subfunction
  3724.                 00h     disable critical region flag
  3725.                 01h     set critical region flag
  3726.                         ES:BX   pointer to flag byte set while inside DOS calls
  3727.                 10h     set up SysReq routine
  3728.                 11h     completion of SysReq routine (software only)
  3729.  
  3730.  
  3731. Function 21h    Read Power-On Self Test (POST) Error Log           (PS/2 50+)
  3732. entry   AH      21h
  3733.         AL      00h     read POST log
  3734.                 01h     write POST log
  3735.                         BH      device ID
  3736.                         BL      device error code
  3737. return  CF      set on error
  3738.         AH      status
  3739.                 00h     successful read
  3740.                         BX      number of POST error codes stored
  3741.                         ES:DI   pointer to error log
  3742.                 01h     list full
  3743.                 80h     invalid command
  3744.                 86h     function unsupported
  3745. note    The log is a series of words, the first byte of which identifies the
  3746.         error code and the second is the device ID.
  3747.  
  3748.  
  3749. Function 40h    Read/Modify Profiles                            (Convertible)
  3750. entry   AH      40h
  3751.         AL      00h     read system profile in CX,BX
  3752.                 01h     write system profile from CX, BX
  3753.                 02h     read internal modem profile in BX
  3754.                 03h     write internal modem profile from BX
  3755.         BX      profile info
  3756. return  BX      internal modem profile (from 02h)
  3757.         CX,BX   system profile (from 00h)
  3758.  
  3759.  
  3760. Function 41h    Wait On External Event                          (Convertible)
  3761. entry   AH      41h
  3762.         AL      condition type
  3763.            bits 0-2     condition to wait for
  3764.                         0,0,0   any external event
  3765.                         0,0,1   compare and return if equal
  3766.                         0,1,0   compare and return if not equal
  3767.                         0,1,1   test and return if not zero
  3768.                         1,0,0   test and return if zero
  3769.                 3       reserved
  3770.                 4       0       user byte
  3771.                         1       port address
  3772.                 5-7     reserved
  3773.         BH      condition compare or mask value
  3774.                 condition codes:
  3775.                 00h     any external event
  3776.                 01h     compare and return if equal
  3777.                 02h     compare and return if not equal
  3778.                 03h     test and return if not zero
  3779.                 04h     test and return if zero
  3780.         BL      timeout value times 55 milliseconds
  3781.                 00h     if no time limit
  3782.         DX      I/O port address (if AL bit 4=1)
  3783.         ES:DI   pointer to user byte (if AL bit 4=0)
  3784.  
  3785.  
  3786. Function 42h    Request System Power Off                        (Convertible)
  3787. entry   AH      42h
  3788.         AL      00h     to use system profile
  3789.                 01h     to force suspend regardless of profile
  3790. return  unknown
  3791.  
  3792.  
  3793. Function 43h    Read System Status                              (Convertible)
  3794. entry   AH      43h
  3795. return  AL      status byte
  3796.             bit 0       LCD detached
  3797.                 1       reserved
  3798.                 2       RS232/parallel powered on
  3799.                 3       internal modem powered on
  3800.                 4       power activated by alarm
  3801.                 5       bad time
  3802.                 6       external power in use
  3803.                 7       battery low
  3804.  
  3805.  
  3806. Function 44h    (De)activate Internal Modem Power               (Convertible)
  3807. entry   AH      44h
  3808.         AL      00h      to power off
  3809.                 01h      to power on
  3810. return  unknown
  3811.  
  3812.  
  3813. Function 4Fh    OS Hook - Keyboard Intercept          (except PC, PCjr, and XT)
  3814. entry   AH      4Fh
  3815.         AL      scan code, CF set
  3816. return  AL      scan code
  3817.         CF      set     processing desired
  3818.                 clear   scan code should not be used
  3819. note 1) Called by int 9 handler for each keystroke to translate scan codes.
  3820.      2) An OS or a TSR can capture this function to filter the raw keyboard
  3821.         data stream. The new handler can substitute a new scan code, return the
  3822.         same scan code, or return the carry flag clear causing the keystroke to
  3823.         be discarded. The BIOS default routine simply returns the scan code
  3824.         unchanged.
  3825.      3) A program can call int 15h/fn0C0h to determine whether the host
  3826.         machine's BIOS supports keyboard intercept.
  3827.      4) Used internally by PC-MOS/386 v4.00+ for keyboard input.
  3828.      5) Some BIOSes do not properly support this call. However, some versions
  3829.         of KEYB.COM provide additional 4Fh support.
  3830.  
  3831.  
  3832. Function 52h    MicroSoft RAM-Resident Software Specification 1.0
  3833.                 This standard was proposed by MicroSoft in 1986 as a common
  3834.                 interface for TSR programs. It appears to have been largely
  3835.                 unknown or disregarded.
  3836.  
  3837. Function 0: Get Program Information by Name
  3838. entry   DS:BX   The Program ID of the memory-resident program to look for
  3839. return  AL      0FFh    if the program we are looking for is installed
  3840.                 00h     if it is not installed
  3841.         CX      The number of this program. The first program installed is
  3842.                 number 0, with the second program being number 1, etc. By using
  3843.                 a dynamic numbering system, we avoid conflicts between programs
  3844.                 that might otherwise choose the same ID. We also provide a good
  3845.                 way to scan all the resident programs using function 1.
  3846.         ES:DX   pointer to the Program ID Record (PIDR)
  3847. note    This function tests to see if a program is memory resident and returns
  3848.         a pointer to its program information if it is resident. To use this
  3849.         function, set DS:BX to point to the program ID. Each installed program
  3850.         will check to see if this program ID agrees with its own internal
  3851.         program ID.
  3852.  
  3853. Function 1: Get Program Information by Number
  3854. entry   CX      Number of the program we want the information for
  3855.  
  3856. return  AL      0FFh    if the program we are looking for is installed
  3857.                 00h     if it is not installed
  3858.         ES:DX   pointer to the Program ID Record (PIDR)
  3859. note    This function returns exactly the same information as function 0. The
  3860.         only difference is how we identify the program we want, which is
  3861.         determined by its position in the interrupt chain; program 0 is the
  3862.         last program in the chain, and the first program in the chain (usually
  3863.         the most recently installed) has the highest number.
  3864.  
  3865. Function 2: Activate Program
  3866. entry   CX      The number of the program we want to activate
  3867.         DS:BX   Activation Record. This record will give program information on
  3868.                 how and what it should activate within the program
  3869. return  none
  3870. note    This function activates one of the installed programs. It is useful
  3871.         if you want to control many desk accessories with a single control
  3872.         panel like the one used in SideKick. You can also use it with a
  3873.         program like ProKey to run a named macro under program control, or
  3874.         with SideKick to bring up one of the desk accessories from within a
  3875.         program or batch file.
  3876.  
  3877. Function 3: Deactivate Program
  3878. entry   CX      The number of the program we want to deactivate
  3879.         DS:BX   Deactivation Record. This record will give program information
  3880.                 on how and what it should deactivate within the program
  3881. return  none
  3882. note    This function is the opposite of function 2 (activate program).
  3883.  
  3884. Function 4: Enable Program
  3885. entry   CX      The number of the program we want to enable
  3886.         DS:BX   Enable mask record. This mask describes what features we want
  3887.                 to enable. A null record enables all the features.
  3888. return  none
  3889. note    This function is the opposite of function 5 (disable program).
  3890.  
  3891. Function 5: Disable Program
  3892. entry   CX      The number of the program we want to disable
  3893.         DS:BX   Disable mask record.  This mask describes what features we want
  3894.                 to disable. A null record disables all the features.
  3895. return  none
  3896. note    Sometimes it becomes necessary to disable a program to prevent it from
  3897.         conflicting with another program, this function is designed to do that.
  3898.         This function is the opposite of function 4 (Enable Program).
  3899.  
  3900.  
  3901. Function 70h    EEROM handler                                (Tandy 1000HX)
  3902. entry   AH      00h     read from EEROM
  3903.                 BL      00h
  3904.                 01h     write to EEROM
  3905.                 BL      word number to write (0-15)
  3906.                 DX      word value to write
  3907. return  DX      (AH=00h) word value
  3908.         CF      set on error (system is not a Tandy 1000 HX)
  3909.  
  3910.  
  3911. Function 80h    OS Hook - Device Open                        (AT, XT/286, PS/2)
  3912. entry   AH      80h
  3913.         BX      device ID
  3914.         CX      process ID
  3915. return  CF      set on error
  3916.         AH      status
  3917. note 1) Acquires ownership of a logical device for a process.
  3918.      2) This call, along with fns 81h and 82h, defines a simple protocol that
  3919.         can be used to arbitrate usage of devices by multiple processes. A
  3920.         multitasking program manager would be expected to capture int 15h and
  3921.         provide the appropriate service.
  3922.      3) The default BIOS routine for this function simply returns with CF clear
  3923.         and AH=00h.
  3924.  
  3925.  
  3926. Function 81h    Device Close                               (AT, XT/286, PS/2)
  3927. entry   AH      81h
  3928.         BX      device ID
  3929.         CX      process ID
  3930. return  CF      set on error
  3931.         AH      status
  3932. note 1) Releases ownership of a logical device for a process.
  3933.      2) A multitasking program manager would be expected to capture int 15h and
  3934.         provide the appropriate service.
  3935.      3) The BIOS default routine for this function simply returns with the CF
  3936.         clear and AH=00h.
  3937.  
  3938.  
  3939. Function 82h    Program Termination                          (AT, XT/286, PS/2)
  3940.         AH      82h
  3941.         BX      device ID
  3942. return  CF      set on error
  3943.         AH      status
  3944. note 1) Closes all logical devices opened with function 80h.
  3945.      2) A multitasking program manager would be expected to capture int 15h and
  3946.         provide the appropriate service.
  3947.      3) The BIOS default routine for this function simply returns with CF clear
  3948.         and AH=00h.
  3949.  
  3950.  
  3951. Function 83h    Event Wait                 (AT, XT/286, Convertible, PS/2 50+)
  3952. entry   AH      83h
  3953.         AL      00h     to set interval
  3954.                 01h     to cancel
  3955.         CX:DX   number of microseconds to wait (granularity is 976 microseconds)
  3956.         ES:BX   pointer to semaphore flag (bit 7 is set when interval expires)
  3957.                 (pointer is to caller's memory) (some sources list bit 15 set)
  3958. return  CF      clear   OK
  3959.                 set     function already busy
  3960. note 1) Requests setting of a semaphore after a specified interval or cancels a
  3961.         previous request.
  3962.      2) The calling program is responsible for clearing the semaphore before
  3963.         requesting this function.
  3964.      3) The actual duration of an event wait is always an integral multiple of
  3965.         976 microseconds. The CMOS date/clock chip interrupts are used to
  3966.         implement this function.
  3967.      4) Use of this function allows programmed, hardware-independent delays at
  3968.         a finer resolution than can be obtained through use of the MS-DOS Get
  3969.         Time function (int 21h/fn 2Ch) which returns time in hundredths of a
  3970.         second.
  3971.      5) CX:DX is a four-byte integer.
  3972.      7) This function is called by int 70h and is not the normal Int 08h/1Ch
  3973.         clock tick. It is generated by the MC146818A Real Time Clock chip.
  3974.         This is the battery backed up CMOS clock chip.
  3975.  
  3976.  
  3977. Function 84h    Read Joystick Input Settings                 (AT, XT/286, PS/2)
  3978. entry   AH      84h
  3979.         DX      00h     to read the current switch settings  (return in AL)
  3980.                 01h     to read the resistive inputs
  3981. return  CF      set on error
  3982.         (fn 00h)
  3983.         AL      switch settings (bits 7-4)
  3984.         (fn 01h)
  3985.         AX      stick A (X) value
  3986.         BX      stick A (Y) value
  3987.         CX      stick B (X) value
  3988.         DX      stick B (Y) value
  3989. note 1) An error is returned if DX does not contain a valid subfunction number.
  3990.      2) If no game adapter is installed, all returned values are 00h.
  3991.      3) Using a 250K Ohm joystick, the potentiometer values usually lie within
  3992.         the range 0-416 (0000h-01A0h).
  3993.  
  3994.  
  3995. Function 85h    System Request (SysReq) Key Pressed        (except PC, PCjr, XT)
  3996. entry   AH      85h
  3997.         AL      00h      key pressed
  3998.                 01h      key released
  3999. return  CF      set on error
  4000.         AH      error code
  4001. note 1) Called by BIOS keyboard decode routine when the SysReq key is detected.
  4002.      2) The BIOS handler for this call is a dummy routine that always returns a
  4003.         success status unless called with an invalid subfunction number in AL.
  4004.      3) A multitasking program manager would be expected to capture int 15h so
  4005.         that it can be notified when the user strikes the SysReq key.
  4006.  
  4007.  
  4008. Function 86h    Delay                                 (except PC, PCjr, XT)
  4009.         AH      86h
  4010.         CX:DX   4-byte integer, number of microseconds to wait
  4011.                 CX high word, DX low word
  4012. return  CF      clear   after wait elapses
  4013.         CF      set     immediately due to error
  4014. note 1) Suspends the calling program for a specified interval in microseconds.
  4015.      2) The actual duration of the wait is always an integral multiple of 976
  4016.         microseconds.
  4017.      3) Use of this function allows programmed, hardware-independent delays at
  4018.         a finer resolution than can be obtained through use of the MS-DOS Get
  4019.         Time function (int 21h fn 2Ch) which returns time in hundredths of a
  4020.         second).
  4021.      4) This function calls int 70h and is not the normal Int 08h/1Ch
  4022.         clock tick. It is generated by the MC146818A Real Time Clock chip.
  4023.         This is the battery backed up CMOS clock chip.
  4024.  
  4025.  
  4026. Function 87h    Memory Block Move                       (2-3-486 machines only)
  4027.         AH      87h
  4028.         CX      number of words to move
  4029.         ES:SI   pointer to Global Descriptor Table (GDT)
  4030.                 offset 00h-0Fh  reserved, set to zero
  4031.                            00h  null descriptor
  4032.                            08h  uninitialized, will be made into GDT descriptor
  4033.                        10h-11h  source segment length in bytes
  4034.                                 (2*CX-1 or greater)
  4035.                        12h-14h  24-bit linear source address
  4036.                        15h      access rights byte (always 93h)
  4037.                        16h-17h  reserved, set to zero
  4038.                        18h-19h  destination segment length in bytes
  4039.                                 (2*CX-1 or greater)
  4040.                        1Ah-1Ch  24-bit linear destination address
  4041.                        1Dh      access rights byte (always 93h)
  4042.                        1Eh-1Fh  reserved, set to zero
  4043.                            20h *uninitialized, used by BIOS
  4044.                            28h *uninitialized, will be made into SS descriptor
  4045.                               (*) some sources say initialized to zero
  4046. return  CF      set on error
  4047.         AH      status
  4048.                 00h     success - source copied into destination
  4049.                 01h     RAM parity error
  4050.                 02h     exception interrupt error
  4051.                 03h     address line 20 gating failed
  4052. note 1) The GDT table is composed of six 8-byte descriptors to be used by the
  4053.         CPU in protected mode. The four descriptors in offsets 00h-0Fh and
  4054.         20h-2Fh are filled in by the BIOS before the CPU mode switch.
  4055.      2) The addresses used in the descriptor table are linear (physical)
  4056.         24-bit addresses in the range 000000h-0FFFFFFh - not segments and
  4057.         offsets - with the least significant byte at the lowest address and the
  4058.         most significant byte at the highest address.
  4059.      3) Interrupts are disabled during this call; use may interfere with the
  4060.         operation of comm programs, network drivers, or other software that
  4061.         relies on prompt servicing of hardware interrupts.
  4062.      4) This call is not valid in the OS/2 Compatibility Box.
  4063.      5) This call will move a memory block from any real or protected mode
  4064.         address to any other real or protected mode address.
  4065.      6) DESQview does not intercept function 87, but QEXT and QEMM do, thereby
  4066.         allowing function 87 to work correctly inside DV.  VDISK, which uses
  4067.         function 87, works inside DV.  If VDISK is sitting at the 1 MB mark,
  4068.         then the int 19h vector will have a VDISK signature in it.  The normal
  4069.         way to check for VDISK presence is by checking for the string "VDISK"
  4070.         at offset 12h of the segment of the int 19h vector.  If the string
  4071.         matches, then you can determine how much extended memory is reserved
  4072.         for VDISK by looking at offset 2Ch is the 3-byte address of the lowest
  4073.         extended memory address NOT in use by VDISK (i.e. if you see at 2Ch
  4074.         "00 00 14" then that means that VDISK is using memory up to 1 MB +
  4075.         256K).
  4076.  
  4077.  
  4078. Function 88h    Get Extended Memory Size                   (AT, XT/286, PS/2)
  4079. entry   AH      88h
  4080. return  AX      number of contiguous 1K blocks of extended memory starting at
  4081.                 address 1024k
  4082. note 1) This call will not work in the OS/2 Compatibility Box.
  4083.      2) Some BIOSes and software manipulate the Carry Flag when this function
  4084.         is called. When tested on a vanilla 386 with AMI BIOS the machine
  4085.         returned with the carry flag set. When 386-to-the-Max was loaded, the
  4086.         flag was not set.
  4087.      3) Used by IBM VDISK 4.0.
  4088.  
  4089.  
  4090. Function 89h    Switch Processor to Protected Mode         (AT, XT/286, PS/2)
  4091. entry   AH      89h
  4092.         BH      interrupt number for IRQ0, written to ICW2 of 8259 PIC #1
  4093.                 (must be evenly divisible by 8, determines IRQ0-IRQ7)
  4094.         BL      interrupt number for IRQ8, written to ICW2 of 8259 PIC #2
  4095.                 (must be evenly divisible by 8, determines IRQ8-IRQ15)
  4096.         ES:SI   pointer to 8-entry Global Descriptor Table for protected mode:
  4097.                 offset  00h     null descriptor, initialized to zero
  4098.                         08h     GDT descriptor
  4099.                         10h     IDT (Interrupt Descriptor Table) descriptor
  4100.                         18h     DS, user's data segment
  4101.                         20h     ES, user's extra segment
  4102.                         28h     SS, user's stack segment
  4103.                         30h     CS, user's code segment
  4104.                         38h     uninitialized, used to build descriptor for
  4105.                                 BIOS code segment
  4106. return  CF      set on error
  4107.                 AH      0FFh  error enabling address line 20
  4108.         CF      clear   function successful (CPU is in protected mode)
  4109.                 AH      00h
  4110.                 CS      user-defined selector
  4111.                 DS      user-defined selector
  4112.                 ES      user-defined selector
  4113.                 SS      user-defined selector
  4114. note 1) The user must initialize the first seven descriptors; the eighth is
  4115.         filled in by the BIOS to provide addressability for its own execution.
  4116.         The calling program may modify and use the eighth descriptor for any
  4117.         purpose after return from this function call.
  4118.      2) Intercepted by Microsoft's HIMEM.SYS and Quarterdeck's QEMM.SYS.
  4119.  
  4120.  
  4121. Function 90h    Device Busy Loop                         (except PC, PCjr, XT)
  4122. entry   AH      90h
  4123.         AL      predefined device type code:
  4124.                 00h     disk                                     (may timeout)
  4125.                 01h     diskette                                 (may timeout)
  4126.                 02h     keyboard                                 (no timeout)
  4127.                 03h     PS/2 pointing device                     (may timeout)
  4128.                 80h     network
  4129.                                                                  (no timeout)
  4130.                 0FCh    hard disk reset (PS/2)                   (may timeout)
  4131.                 0FDh    diskette motor start                     (may timeout)
  4132.                 0FEh    printer                                  (may timeout)
  4133.         ES:BX   pointer to request block for type codes 80h through 0FFh
  4134.                 (for network adapters ES:BX is a pointer to network control
  4135.                 block)
  4136. return  CF      set     if wait time satisfied
  4137.                 clear   if driver must perform wait
  4138. note 1) Used by NETBIOS, TOPS Network, Tom Wagner's CTASK multitasker.
  4139.      2) Generic type codes are allocated as follows:
  4140.         00h-7Fh   non-reentrant devices; OS must arbitrate access
  4141.                   serially reusable devices
  4142.         80h-0BFh  reentrant devices; ES:BX points to a unique control block
  4143.         0C0h-0FFh wait-only calls, no complementary POST int 15/fn 91h call
  4144.      3) Invoked by the BIOS disk, printer, network, and keyboard handlers prior
  4145.         to performing a programmed wait for I/O completion.
  4146.      4) A multitasking program manager would be expected to capture int 15h/
  4147.         fn 90h so that it can dispatch other tasks while I/O is in progress.
  4148.      5) The default BIOS routine for this function simply returns with the CF
  4149.         clear and AH=00h.
  4150.  
  4151.  
  4152. Function 91h    Interrupt Completed                     (AT, XT/286, PS/2 50+)
  4153. entry   AH      91h
  4154.         AL      type code (see AH=90h above)
  4155.                 00h-7Fh  serially reusable devices
  4156.                 80h-0BFh reentrant devices
  4157.         ES:BX   pointer to request block for type codes 80h through 0BFh
  4158. return  AH       00h
  4159. note 1) Used by NETBIOS and TOPS network, Tom Wagner's CTASK multitasker.
  4160.      2) Invoked by the BIOS disk network, and keyboard handlers to signal that
  4161.         I/O is complete and/or the device is ready.
  4162.      3) Predefined device types that may use Device POST are:
  4163.         00H  disk                   (may timeout)
  4164.         01H  floppy disk            (may timeout)
  4165.         02H  keyboard               (no timeout)
  4166.         03H  PS/2 pointing device   (may timeout)
  4167.         80H  network                (no timeout)
  4168.      4) The BIOS printer routine does not invoke this function because printer
  4169.         output is not interrupt driven.
  4170.      5) A multitasking program manager would be expected to capture int 15h/
  4171.         fn 91h so that it can be notified when I/O is completed and awaken the
  4172.         requesting task.
  4173.      6) The default BIOS routine for this function simply returns with the CF
  4174.         flag clear and AH=00h.
  4175.  
  4176.  
  4177. Function 0C0h   Get System Configuration      (XT after 1/10/86, PC Convertible,
  4178.                                                XT/286, AT, PS/2)
  4179. entry   AH      0C0h
  4180. return  CF      set     if BIOS doesn't support call
  4181.         ES:BX   pointer to ROM system descriptor table
  4182.           bytes 00h-01h number of bytes in the following table (norm. 16 bytes)
  4183.                 02h     system ID byte; see Chapter 2 for interpretation
  4184.                 03h     secondary ID distingushes between AT and XT/286, etc.
  4185.                 04h     BIOS revision level, 0 for 1st release, 1 for 2nd, etc.
  4186.                 05h     feature information byte
  4187.                    bits 0       reserved
  4188.                         1       Micro Channel bus (instead of ISA or EISA)
  4189.                         2       extended BIOS area allocated at 640k
  4190.                         3       wait for external event supported (int 15fn41)
  4191.                                  used on Convertible; reserved on PS/2 systems
  4192.                         4       kbd intrcpt:int 15h, fn 04h called upon int 09h
  4193.                         5       realtime clock installed
  4194.                         6       second 8259 installed (cascaded IRQ2)
  4195.                         7       DMA channel 3 - used by hard disk BIOS
  4196.                 06h     unknown (set to 0) (reserved by IBM)
  4197.                 07h     unknown (set to 0) (reserved by IBM)
  4198.                 08h     unknown (set to 0)
  4199.                 09h     unknown (set to 0) (Award BIOS copyright here)
  4200. note 1) Int 15h is also used for the Multitask Hook on PS/2 machines. No
  4201.         register settings available yet.
  4202.      2) The 1/10/86 XT BIOS returns an incorrect value for the feature byte.
  4203.      3) Novell documents some versions of Netware prior to 2.2 as having
  4204.         problems on PS/2 machines due to a bug which did not return from the
  4205.         interrupt correctly.
  4206.      4) Some AMI BIOSes do not support this function. (early Dell machines)
  4207.  
  4208.  
  4209. Function 0C1h   Return Extended BIOS Data Area Segment Address         (PS/2)
  4210. entry   AH      0C1h
  4211. return  CF      set on error
  4212.         ES      segment of XBIOS data area
  4213. note 1) The XBIOS Data Area is allocated at the high end of conventional memory
  4214.         during the POST (Power-On-Self-Test) sequence.
  4215.      2) The word at 0040:0013h (memory size) is updated to reflect the reduced
  4216.         amount of memory available for DOS and application programs.
  4217.      3) The 1st byte in the XBIOS Data Area is initialized to its length in K.
  4218.      4) A program can determine whether the XBIOS Data Area exists by using
  4219.         int 15h/fn 0C0h.
  4220.  
  4221.  
  4222. Function 0C2h   Pointing Device BIOS Interface      (DesQview 2.x)    (PS/2)
  4223. entry   AH      0C2h
  4224.         AL      00h     Enable/Disable Pointing Device
  4225.                         BH      00h     disable
  4226.                                 01h     enable
  4227.                 01h     Reset Pointing Device
  4228.                          Resets the system's mouse or other pointing device,
  4229.                         sets the sample rate, resolution, and other
  4230.                         characteristics to their default values.
  4231.                         return  BH      device ID (0=first)
  4232.                         note 1) After a reset operation, the state of the
  4233.                                  pointing device is as follows:
  4234.                                  disabled;
  4235.                                  sample rate at 100 reports per second;
  4236.                                  resolution at 4 counts per millimeter;
  4237.                                  scaling at 1 to 1.
  4238.                              2) The data package size is unchanged by this fn.
  4239.                              3) Apps can use the fn 0C2h subfunctions to
  4240.                                 initialize the pointing device to other parms,
  4241.                                 then enable the device with fn 00h.
  4242.                              4) BL is altered on return.
  4243.                 02h     Set Sampling Rate
  4244.                         BH      00h     10/second
  4245.                                 01h     20/second
  4246.                                 02h     40/second
  4247.                                 03h     60/second
  4248.                                 04h     80/second
  4249.                                 05h     100/second  (default)
  4250.                                 06h     200/second
  4251.                 03h     Set Pointing Device Resolution
  4252.                         BH      00h     one count per mm
  4253.                                 01h     two counts per mm
  4254.                                 02h     four counts per mm  (default)
  4255.                                 03h     eight counts per mm
  4256.                 04h     Get Pointing Device Type
  4257.                         return  BH      ID code for the mouse or other pointing
  4258.                                         device
  4259.                 05h     Initialize Pointing Device Interface
  4260.                          Sets the data package size for the system's mouse or
  4261.                         other pointing device, and initializes the resolution,
  4262.                         sampling rate, and scaling to their default values.
  4263.                         BH      data package size (1 - 8 bytes)
  4264.                         note    After this operation, the state of the pointing
  4265.                                 device is as follows:
  4266.                                 a) disabled;
  4267.                                 b) sample rate at 100 reports per second;
  4268.                                 c) resolution at 4 counts per millimeter;
  4269.                                 d) scaling set at 1 to 1.
  4270.                 06h     Get Status or Set Scaling Factor
  4271.                          Returns the current status of the system's mouse or
  4272.                         other pointing device or sets the device's scaling
  4273.                         factor.
  4274.                         BH      00h     return device status
  4275.                                 return  BL      status byte
  4276.                                   bits  0       set if right button pressed
  4277.                                         1       reserved
  4278.                                         2       set if left button pressed
  4279.                                         3       reserved
  4280.                                         4       0       1:1 scaling
  4281.                                                 1       2:1 scaling
  4282.                                         5       0       device disabled
  4283.                                                 1       device enabled
  4284.                                         6       0       stream mode
  4285.                                                 1       remote mode
  4286.                                         7       reserved
  4287.                                         CL      resolution
  4288.                                                 00h     1 count per millimeter
  4289.                                                 01h     2 counts per millimeter
  4290.                                                 02h     4 counts per millimeter
  4291.                                                 03h     8 counts per millimeter
  4292.                                         DL      sample rate (hex count)
  4293.                                                 0Ah     10  reports per second
  4294.                                                 14h     20  reports per second
  4295.                                                 28h     40  reports per second
  4296.                                                 3Ch     60  reports per second
  4297.                                                 50h     80  reports per second
  4298.                                                 64h     100 reports per second
  4299.                                                 0C8h    200 reports per second
  4300.                                 01h     set scaling to 1:1
  4301.                                 02h     set scaling to 2:1
  4302.                 07h     Set Pointing Device Handler Address
  4303.                          Notifies BIOS pointing device driver of the address
  4304.                         for a routine to be called each time pointing device
  4305.                         data is available.
  4306.                         ES:BX   address of user device handler
  4307.                         return  AL      00h
  4308. return  CF      set on error
  4309.         AH      status
  4310.                 00h     successful
  4311.                 01h     invalid function
  4312.                 02h     invalid input
  4313.                 03h     interface error
  4314.                 04h     need to resend
  4315.                 05h     no device handler installed
  4316. note 1) The values in BH for those functions that take it as input are stored
  4317.         in different locations for each subfunction.
  4318.      2) The user's handler for pointing device data is entered via a far call
  4319.         with four parameters on the stack:
  4320.         SS:SP+0Ah    status
  4321.         SS:SP+08h    x coordinate
  4322.         SS:SP+06h    y coordinate
  4323.         SS:SP+04h    z coordinate (always 0)
  4324.          The handler must exit via a far return without removing the parameters
  4325.         from the stack.
  4326.      3) The status parameter word passed to the user's handler is interpreted
  4327.         as follows:
  4328.         bits    0       left button pressed
  4329.                 1       right button pressed
  4330.                 2-3     reserved
  4331.                 4       sign of x data is negative
  4332.                 5       sign of y data is negative
  4333.                 6       x data has overflowed
  4334.                 7       y data has overflowed
  4335.                 8-0Fh   reserved
  4336.  
  4337.  
  4338. Function 0C3h   Enable/Disable Watchdog Timeout                 (PS/2 50+)
  4339. entry   AH      0C3h
  4340.         AL      00h     disable watchdog
  4341.                 01h     enable watchdog
  4342.                         BX      timer counter
  4343. return  CF      set on error
  4344. note 1) The watchdog timer generates an NMI.
  4345.      2) This would be subject to protection with a real OS so temporary masters
  4346.         would not be able to seize the bus forever.
  4347.  
  4348.  
  4349. Function 0C4h   Programmable Option Select                      (PS/2 50+)
  4350. entry   AH      0C4h
  4351.         AL      00h     return base POS register address
  4352.                 01h     enable slot
  4353.                         BL      slot number
  4354.                 02h     enable adapter
  4355. return  CF      set on error
  4356.         DX      base POS register address (if function 00h)
  4357. note 1) Fn 00h returns the base Programmable Option Select register address,
  4358.         enables a slot for setup, or enables an adapter.
  4359.      2) Valid on machines with Micro Channel Architecture (MCA) bus only.
  4360.      3) After a slot is enabled with fn 01h, specific information can be
  4361.         obtained for the adapter in that slot by performing port input
  4362.         operations:
  4363.         Port    Function
  4364.         100h    MCA ID (low byte)
  4365.         101h    MCA ID (high byte)
  4366.         102h    Option Select Byte 1
  4367.             bit 0       0       if disabled
  4368.                         1       if enabled
  4369.         103h    Option Select Byte 2
  4370.         104h    Option Select Byte 3
  4371.         105h    Option Select Byte 4
  4372.                 bits 6-7 are channel check indicators
  4373.         106h    Subaddress Extension (low byte)
  4374.         107h    Subaddress Extension (high byte)
  4375.  
  4376.  
  4377. Function 0C5h   Used by PS/2 Model 50+ and Olivetti MCA machines
  4378.                 Used by Desqview 2.2
  4379.                 Used by Lotus 123 Release 2.2
  4380.                 Used by Microsoft Word 5.0
  4381. note    Functions unknown. Reported by InfoWorld Nov 13 1989's Micro Channel
  4382.         386 test as a conflict between the above software packages. InfoWorld
  4383.         said that Quarterdeck (Desqview) was working on a fix for their
  4384.         product. No other information.
  4385.  
  4386.  
  4387. Function 0DEh   DesQview Services                             (DesQview)
  4388.  
  4389.  
  4390. ┌─────────────────────────────────────────────────────────────────────────────┐
  4391. │Interrupt 16h  Keyboard I/O                                            3**9  │
  4392. └─────────────────────────────────────────────────────────────────────────────┘
  4393. (0:0058h)       Access the keyboard. Scancodes are found in Appendix 1. ASCII
  4394.                 codes are found in Appendix 2.
  4395.  
  4396.                 IBM's original keyboard layout is referred to as the 84-key
  4397.                 or "old style". It has the function keys on the left and an
  4398.                 embedded cursor/numeric keypad on the right. The 101-key "new
  4399.                 style" or "enhanced" keyboard (such as used on the PS/2s) adds
  4400.                 several keys. The early BIOS will not detect the new scancodes
  4401.                 and the new BIOS for some reason added new function calls for
  4402.                 this purpose instead of enhancing the old ones. This causes
  4403.                 some hassle when writing programs which need to support both
  4404.                 keyboards fully. Most programs limit themselves to the 84-key
  4405.                 functions in the interest of backward compatibility.
  4406.  
  4407.                 The SWITCHES CONFIG.SYS command forces DOS 4.0 to use the
  4408.                 standard int 16h requests for keyboard I/O rather than the
  4409.                 extended int 16h requests.
  4410.  
  4411.                 The DOS KEYB command does not hook into the BIOS. It is a total
  4412.                 replacement for the BIOS int9 driver. The only good thing about
  4413.                 this is that you can use 101-key keyboards on old ATs without
  4414.                 support for enhanced keyboards. KEYB is very peculiar in its
  4415.                 handling of the keyboard, causing some programs to break. It
  4416.                 also tends to disable interrupts for a long time while process-
  4417.                 ing each scan code.
  4418.  
  4419.                 There are machines such as the Toshiba 5200 which have 84-key
  4420.                 layouts but "simulate" being 101-key, at least as far as int 16
  4421.                 goes.  (always good for confusing your software...)
  4422.  
  4423.  
  4424. Function  00h   Get Keyboard Input - read the next character in keyboard buffer,
  4425.                 if no key ready, wait for one.
  4426. entry   AH      00h
  4427. return  AH      scan code
  4428.         AL      ASCII character
  4429. note 1) Removes keystroke from buffer (destructive read).
  4430.      2) Does not work with the extra keys on the 101-key "enhanced" keyboard.
  4431.  
  4432.  
  4433. Function  01h   Check Keystroke Buffer - Do Not Clear
  4434. entry   AH      01h
  4435. return  ZF      0 (clear) if character in buffer
  4436.                 1 (set)   if no character in buffer
  4437.         AH      scan code of character (if ZF=0)
  4438.         AL      ASCII character if applicable
  4439. note 1) Keystroke is not removed from buffer. The same character and scan code
  4440.         will be returned by the next call to Int 16h/fn 00h.
  4441.      2) This call flushes the 101-key codes from the buffer if they precede
  4442.         an 84-key code.
  4443.  
  4444.  
  4445. Function  02h   Shift Status - fetch bit flags indicating shift status
  4446. entry   AH      02h
  4447. return  AL      status byte (same as [0040:0017])
  4448.            bits 7       Insert on
  4449.                 6       CapsLock on
  4450.                 5       NumLock on
  4451.                 4       ScrollLock on
  4452.                 3       Alt key down
  4453.                 2       Control key down
  4454.                 1       Left shift (left caps-shift key) down
  4455.                 0       Right shift (right caps-shift key) down
  4456. note    The Keyboard Flags Byte is stored in the BIOS Data Area at 0000:0417h.
  4457.  
  4458.  
  4459. Function 03h    Keyboard - Set Repeat Rate            (PCjr, AT, XT/286, PS/2)
  4460. entry   AH      03h
  4461.         AL      00h     reset typematic defaults                     (PCjr)
  4462.                 01h     increase initial delay                       (PCjr)
  4463.                 02h     decrease repeat rate by 1/2                  (PCjr)
  4464.                 03h     increase both delays by 1/2                  (PCjr)
  4465.                 04h     turn off typematic                           (PCjr)
  4466.                 05h     set typematic rate                           (AT, PS/2)
  4467.         BH      00h-03h for delays of 250ms, 500ms, 750ms, or 1 second
  4468.                         0,0     250ms
  4469.                         0,1     500ms
  4470.                         1,0     750ms
  4471.                         1,1     1 second
  4472.         BL      00h-1Fh for typematic rates of 30cps down to 2cps
  4473.                         00000 30     01011 10.9   10101 4.5
  4474.                         00001 26.7   01100 10     10110 4.3
  4475.                         00010 24     01101 9.2    10111 4
  4476.                         00011 21.8   01110 8.6    11000 3.7
  4477.                         00100 20     01111 8      11001 3.3
  4478.                         00101 18.5   10000 7.5    11010 3
  4479.                         00110 17.1   10001 6.7    11011 2.7
  4480.                         00111 16     10010 6      11100 2.5
  4481.                         01000 15     10011 5.5    11101 2.3
  4482.                         01001 13.3   10011 5.5    11110 2.1
  4483.                         01010 12     10100 5      11111 2
  4484. return  nothing
  4485. note 1) Subfunction 05h is available on ATs with ROM BIOS dated 11/15/85 and
  4486.         later, the XT/286, and the PS/2.
  4487.      2) Subfunction 0 (Return to Default Keyboard State) restores the keyboard
  4488.         to its original state. The original state at power-on is typematic on,
  4489.         normal initial delay and normal typematic rate.
  4490.      3) Subfunction 1 (Increase Initial Delay) increases the delay between the
  4491.         first character typed and the burst of typematic characters.
  4492.      4) For Subfunctions 0 through 4, each time the typematic rate is changed,
  4493.         all previous states are removed.
  4494.      5) Some clone keyboards (Northgate Omnikey and Focus) have much higher
  4495.         repeat rates for the same bit values.
  4496.  
  4497.  
  4498. Function 04h    Keyboard Click Toggle                 (PCjr and Convertible)
  4499. entry   AH      04h
  4500.         AL      00h     for click off
  4501.                 01h     for click on
  4502. return  nothing
  4503.  
  4504.  
  4505. Function 05h    Load Keyboard Buffer            (AT or PS/2 with enhanced kbd)
  4506. entry   AH      05h
  4507.         CH      scan code
  4508.         CL      ASCII character
  4509. return  CF      set on error
  4510.         AL      00h     success
  4511.                 01h     if buffer full
  4512. note    Places a character and scan code at the end of the keyboard type-ahead
  4513.         buffer.
  4514.  
  4515.  
  4516. Function 06h    Keyboard Buffer Write                (Fansi-Console to 2.00)
  4517. entry   AH      06h
  4518.         BX      extended key value to place in typeahead buffer
  4519. return  unknown
  4520. note    This call may be dropped since it now duplicates function 05h.
  4521.  
  4522.  
  4523. Function 07h    Change Shift Key Status              (Fansi-Console to 2.00)
  4524. entry   AH      07h
  4525.         AL      shift key status value
  4526. return  unknown
  4527. note    Status byte is same as function 02h.
  4528.  
  4529.  
  4530. Function 10h    Get Enhanced Keystroke And Read      (F11, F12 Enhanced Keyb'd)
  4531.                 (XT/286, PS/2, AT with "Enhanced" keyboard)
  4532. entry   AH      10h
  4533. return  AH      scan code
  4534.         AL      ASCII character if applicable
  4535. note 1) Reads a character and scan code from the keyboard type-ahead buffer.
  4536.      2) Use this function for the enhanced keyboard instead of int 16h fn 00h.
  4537.         It allows applications to obtain the scan codes for the additional F11,
  4538.         F12, and cursor control keys.
  4539.      3) This is the enhanced version of function 00h.
  4540.  
  4541.  
  4542. Function 11h    Check Enhanced Keystroke         (F11-F12 on enhanced keyboard)
  4543.                 (XT/286, PS/2, AT with "Enhanced" keyboard)
  4544. entry   AH      11h
  4545. return  ZF      0       (clear) if key pressed
  4546.                         AH      scan code
  4547.                         AL      ASCII character if applicable
  4548.                 1       if buffer is empty
  4549. note 1) Keystroke is not removed from buffer. The same char and scan code will
  4550.         be returned by the next call to Int 16h/fn 10h.
  4551.      2) Use this function for the enhanced keyboard instead of int 16h/fn 00h.
  4552.         It allows applications to test for the additional F11, F12, and cursor
  4553.         control keys.
  4554.  
  4555.  
  4556. Function 12h    Extended Get Shift Status         (F11, F12 Enhanced keyboard)
  4557. entry   AH      12h
  4558. return  AX      status word
  4559.                 AL bit  0       right Shift key depressed
  4560.                         1       left Shift key depressed
  4561.                         2       Control key depressed
  4562.                         3       Alt key depressed
  4563.                         4       ScrollLock state active
  4564.                         5       NumLock state active
  4565.                         6       CapsLock state active
  4566.                         7       insert state is active
  4567.                 AH bit  0       left Control key pressed
  4568.                         1       left Alt key depressed
  4569.                         2       right Control key pressed
  4570.                         3       right Alt key depressed
  4571.                         4       Scroll Lock key depressed
  4572.                         5       NumLock key depressed
  4573.                         6       CapsLock key depressed
  4574.                         7       SysReq key depressed
  4575. note    Use this function for the enhanced keyboard instead of int 16h/fn 02h.
  4576.  
  4577.  
  4578. Function  70h, 71h, 72h  Internal Functions       (SEAware's FAKEY.COM)
  4579. note    FAKEY.COM is a TSR keyboard utility distributed to registered users
  4580.         of SEAware products.
  4581.  
  4582.  
  4583. Function  75h   Set Tick Count for Scanning       (pcAnywhere 2.00)
  4584. entry   AH      75h
  4585.         AL      tick count
  4586. return  none
  4587. note 1) Sets count of 55ms timer ticks between checks for new screen changes.
  4588.      2) pcAnywhere is a program that allows operation of a remote machine
  4589.         over a serial link.
  4590.  
  4591.  
  4592. Function  76h   Set Error Checking Mode           (pcAnywhere 2.00)
  4593. entry   AH      76h
  4594.         AL      error checking type
  4595.                 00h     none
  4596.                 01h     fast
  4597.                 02h     slow
  4598. return  none
  4599.  
  4600.  
  4601. Function  77h   reserved                          (pcAnywhere 2.00)
  4602. pcAnywhere API - reserved
  4603.  
  4604.  
  4605. Function  78h   Log Off                           (pcAnywhere 2.00)
  4606. entry   AL      00h     wait for another call
  4607.                 01h     exit but remain TSR
  4608.                 02h     automatic mode - watches DTR
  4609.                 0FFh    leave in current operating mode (pcAnywhere 2.1)
  4610. return  none
  4611.  
  4612.  
  4613. Function  79h   Installation Check                (pcAnywhere 2.00)
  4614. entry   AH      79h
  4615.         AL      00h     installation check
  4616. return  AX      0FFFFh  resident and active
  4617.                 0FFFEh  resident but not active
  4618.                 0FFFDh  resident TSR
  4619.                 0FFFCh  automatic mode
  4620.                 any other value - not resident
  4621.  
  4622.  
  4623. Function  7Ah   Cancel pcAnywhere Session         (pcAnywhere 2.00)
  4624. entry   AH      7Ah
  4625. return  none
  4626. note    Leaves pcAnywhere resident but unable to answer another call.
  4627.  
  4628.  
  4629. Function  7Bh   Enable/Disable Operation          (pcAnywhere 2.00)
  4630. entry   AH      7Bh
  4631.         AL      state
  4632.                 00h     disabled
  4633.                 01h     enabled
  4634. return  none
  4635. note    Remote screen is automatically refreshed when session is enabled.
  4636.  
  4637.  
  4638. Function  7Ch   Get Port Configuration            (pcAnywhere 2.00)
  4639. entry   AH      7Ch
  4640. return  AH      port number in binary (0-15)
  4641.         AL      baud rate
  4642.                 00h     50
  4643.                 01h     75
  4644.                 02h     110
  4645.                 03h     134.5
  4646.                 04h     150
  4647.                 05h     300
  4648.                 06h     600
  4649.                 07h     1200
  4650.                 08h     1800
  4651.                 09h     2000
  4652.                 0Ah     2400
  4653.                 0Bh     4800
  4654.                 0Ch     7200
  4655.                 0Dh     9600
  4656.                 0Fh     19,200
  4657.  
  4658.  
  4659. Function  7Dh   Get/Set Terminal Parameters       (pcAnywhere 2.00)
  4660. entry   AH      7Dh
  4661.         AL      00h     set parameters
  4662.                 01h     get parameters
  4663.                 02h     get configuration header and terminal parameters
  4664.         CX:DS   address of Terminal Parameter Block
  4665. return  AL      00h     nothing
  4666.                 01h     current Terminal Parameter Block in CX:DS
  4667.                 02h     configuration header and Terminal Parameter Block
  4668.                         in CX:DS
  4669. note    Terminal Parameter Block format:   (1152 bytes) (decimal)
  4670.         384 bytes  CRT Control Information
  4671.                 bytes   function
  4672.                 1-8     cursor up
  4673.                9-16     cursor down
  4674.               17-24     cursor left
  4675.               25-32     cursor right
  4676.               33-40     cursor home
  4677.               41-48     clear screen
  4678.               49-56     clear to end of line
  4679.               57-64     clear to end of page
  4680.               65-72     insert line
  4681.               73-80     delete line
  4682.               81-88     insert character
  4683.               89-96     delete character
  4684.              97-104     cursor position lead in
  4685.             105-112     between row and column
  4686.             113-120     after cursor position
  4687.             121-128     CRT initialization
  4688.         256 bytes  Character Translation Table
  4689.                 translates ASCII characters from host. Normally changes IBM
  4690.                 graphics characters to other displayable symbols
  4691.         512 bytes  keyboard sequences
  4692.             641-644     cursor up
  4693.             645-648     cursor down
  4694.             649-652     cursor left
  4695.             653-656     cursor right
  4696.             657-660     home
  4697.             661-664     end
  4698.             665-668     PgUp
  4699.             669-672     PgDn
  4700.             673-676     insert
  4701.             677-680     delete
  4702.             681-684     control-home
  4703.             685-688     control-end
  4704.             689-692     control-PgUp
  4705.             693-696     control-PgDn
  4706.             697-700     escape
  4707.             701-740     F1...F10
  4708.             741-780     sF1...sF10
  4709.             781-820     ^F1...^F10
  4710.             821-860     aF1...aF10
  4711.             861-964     alt A-Z
  4712.            965-1004     alt 0-9
  4713.           1005-1008     alt =
  4714.           1009-1012     alt -
  4715.           1013-1016     print screen
  4716.           1017-1020     ctrl-left arrow
  4717.           1021-1024     ctrl-right arrow
  4718.           1025-1120     reserved
  4719.           1121-1124     begin conv. mode
  4720.           1125-1128     remote printing off
  4721.           1129-1132     remote printing on
  4722.           1133-1136     backspace
  4723.           1137-1140     refresh screen
  4724.           1141-1144     send next code
  4725.           1145-1148     display top 24 lines
  4726.           1149-1152     display bottom 24 lines
  4727.  
  4728.  
  4729. Function  7Eh   Serial I/O Through pcAnywhere Port   (pcAnywhere 2.00)
  4730. entry   AH      7Eh
  4731.         AL      I/O function
  4732.                 01h     get port input status
  4733.                 02h     get port input character
  4734.                 03h     output character
  4735.                 04h     hang up phone
  4736.         CX      ASCII character to output (fn 03h)
  4737. return  (if AL=01h)
  4738.         AX      00h     no character ready
  4739.                 01h     character is available
  4740.         (if AL=02h)
  4741.         AL      ASCII code received
  4742.  
  4743.  
  4744. Function  7Fh   Set Keyboard/Screen Mode            (pcAnywhere 2.00)
  4745. entry   AH      7Fh
  4746.         AL      parameters
  4747.                 00h     enable remote keyboard only  |
  4748.                 01h     enable host keyboard only    |  keyboard group
  4749.                 02h     enable both keyboards        |
  4750.  
  4751.                 08h     display top 24 lines         |  screen group
  4752.                 09h     display bottom 24 lines      |
  4753.  
  4754.                 10h     Hayes modem                  |
  4755.                 11h     other modems                 |  modem group
  4756.                 12h     direct connect               |
  4757.  
  4758.  
  4759. Function 0EDh   Borland Turbo Lightning API  (partial)
  4760. entry   AH      0EDh
  4761.         BH      0EDh
  4762.         BL      function
  4763.                 00h     installation check
  4764.                 02h     pointer to Lightning internal data structure lobyte
  4765.                 03h     pointer to Lightning internal data structure hibyte
  4766.                 04h     load auxiliary dictionary
  4767.                 06h     autoproof mode
  4768.                 0Fh     get number of substitutions (segment)
  4769.         DS:DI   pointer to string to be processed
  4770. return  AX      error code (unknown)
  4771. note    I've made several attempts to get a copy of the Turbo Lightning API,
  4772.         which was originally supposed to be available for developers in 1985.
  4773.         In 1988 Borland sent me a letter saying they were still working on it.
  4774.         In late 1989 the Borland rep on BIX told me basically that there were
  4775.         no plans for releasing the API any more. The information here was
  4776.         dredged from Chris Dunford's LSPELL.PAS interface into Lighting.
  4777.  
  4778.  
  4779. Function 0F0h   Set CPU speed                                     (Compaq 386)
  4780. entry   AH      0F0h    set speed
  4781.         AL      speed
  4782.                 00h     equivalent to 6 mHz 80286 (COMMON)
  4783.                 01h     equivalent to 8 mHz 80286 (FAST)
  4784.                 02h     full 16 mHz (HIGH)
  4785.                 03h     toggles between 8 mHz-equivalent and speed set by
  4786.                         system board switch (AUTO or HIGH)
  4787.                 04h-07h unknown
  4788.                 08h     full 16 mHz except 8 mHz-equivalent during floppy disk
  4789.                         access
  4790.                 09h     specify speed directly
  4791.                         CX      speed value, 1 (slowest) to 50 (full), 3 ~=8088
  4792. return  none?
  4793. note 1) Used by Compaq DOS MODE command.
  4794.  
  4795.  
  4796. Function 0F1h   Read Current CPU Speed                            (Compaq 386)
  4797. entry   AH      0F1h
  4798. return  AL      speed code (see function 0F0h above)
  4799.                 if AL=09h, CX=speed code
  4800.  
  4801.  
  4802. Function 0F2h   Determine Attached Keyboard Type                  (Compaq 386)
  4803. entry   AH      0F2h
  4804. return  AL      type
  4805.                 00h     if 11-bit AT keyboard is in use
  4806.                 01h     if 9-bit PC keyboard is in use
  4807.  
  4808.  
  4809. Function 0FFh   PC-Tools API
  4810. entry   AH      0FFh
  4811. other parameters unknown
  4812. note    PC-Tools is a Swiss-army-knife software package with an editor, DOS
  4813.         shell, cache, disk optimizer, and several other functions from Central
  4814.         Point Software.
  4815.  
  4816.  
  4817. Function 0FFh   2-The-Max VGA-16 Board
  4818. entry   AH      0FFh    query zoom interrupt
  4819. return  AL      zoom interrupt number
  4820.         AL+1    old BIOS keyboard handler interrupt number
  4821.         BX      hot key
  4822.  
  4823.  
  4824.  
  4825. Function 0FFh   Programmer Interface to Carbon Copy Plus (5.0)
  4826. entry   AH      0FFh
  4827.         AL      00h     check connection between CC and CCHELP
  4828. return  BL      00h     Carbon Copy not connected to CCHELP
  4829.                 01h     Carbon Copy is connected to CCHELP
  4830.  
  4831. entry   AL      01h     disconnects and resets the line if the Host or CC
  4832.                         side is connected to CCHELP
  4833.  
  4834. entry   AL      02h     return a pointer to the last phone number dialed by CC
  4835. return  ES:DI           dword pointer to ASCIIZ phone number string
  4836.  
  4837.  
  4838.  
  4839. ┌─────────────────────────────────────────────────────────────────────────────┐
  4840. │Interrupt 17h  Printer                                                 3**10 │
  4841. └─────────────────────────────────────────────────────────────────────────────┘
  4842. (0:005Ch)       access the parallel printer(s)
  4843.                 AH is changed. All other registers left alone.
  4844.  
  4845.                 Printer ports vary widely in compatibility, since the original
  4846.                 IBM MDA's parallel port did not match its own spec.  Many
  4847.                 parallel ports do not use IRQ7 at all.
  4848.  
  4849.                 The parallel port on a monochrome adapter is at 3BCh.  The port
  4850.                 on a parallel printer adapter is at 378h or 278h.  At boot time,
  4851.                 the BIOS looks at them in the order 3BCh, 378h, 278h, and
  4852.                 assigns the first port it finds to LPT1, the second to LPT2,
  4853.                 etc.  If you have a monochrome adapter, LPT1 is probably 3BCh;
  4854.                 otherwise, it is probably 378h.
  4855.  
  4856.  
  4857. Function  00h   Print Character/send AL to printer DX (0, 1, or 2)
  4858. entry   AH      00h
  4859.         AL      ASCII character code
  4860.         DX      printer to be used
  4861.                 00h     PRN or LPT1
  4862.                 01h     LPT2
  4863.                 02h     LPT3
  4864. return  AH      status byte
  4865.            bits 0       time out
  4866.                 1       unused
  4867.                 2       unused
  4868.                 3       I/O error
  4869.                 4       printer selected
  4870.                 5       out of paper
  4871.                 6       acknowledge
  4872.                 7       not busy
  4873.  
  4874.  
  4875. Function 01h    Initialize Printer - set init line low, send 0Ch to printer DX
  4876. entry   AH      01h
  4877.         DX      printer port to be initialized (0,1,2)
  4878. return  status as below
  4879.  
  4880.  
  4881. Function  02h   Printer Status - read status of printer DX into AH
  4882. entry   AH      02h
  4883.         DX      printer port to be used (0,1,2)
  4884. return  AH      status byte
  4885.            bits 7       0       busy/paused: the printer cannot immediately
  4886.                                 take more data because it is in the middle of
  4887.                                 accepting a character, printing a line, is
  4888.                                 offline, or it is in error status.
  4889.                         1       ready
  4890.                 6   ACKnowledge line toggled: reflects the state of the ACK
  4891.                     line on the printer port at the moment the status was read.
  4892.                     ACK is a strobe: it goes low for a very short time (12
  4893.                     microseconds on an Epson) when the printer is ready for
  4894.                     another character. As far as printer status is concerned,
  4895.                     this is useless; it's only useful for something like an
  4896.                     interrupt-driven interface. Most of the time, you'll see
  4897.                     ACK high (bit 6 on), but occasionally, if you check status
  4898.                     just after sending a character, you might see it low.
  4899.                     ACK is low when the printer is powered off.
  4900.                 5   out-of-paper line toggled
  4901.                 4   printer selected: printer is selected/ready/online. There
  4902.                     is usually a button on the printer to control this.
  4903.                 3   I/O error: offline, out of paper or other error condition
  4904.                     such as out of ribbon.
  4905.                 2   unused
  4906.                 1   unused
  4907.                 0   timeout error: printer failed to send ACK and drop busy
  4908.                     after being sent a character.
  4909. note 1) You can expect to see these states in a properly functioning printer:
  4910.         Normal                Offline                Power off
  4911.         ======                =======                =========
  4912.         not busy/paused       busy/paused            busy/paused
  4913.         not out of paper      not out of paper       not out of paper
  4914.         selected/online       not selected/online    not selected/online
  4915.         not I/O error         I/O error (usually)    I/O error
  4916.         not timeout error     not timeout error      not timeout error
  4917.      2) Not all printers return the status codes properly. That's OK, not all
  4918.         clone BIOS do it right either. If your program depends on the return
  4919.         codes, you might want to make the code easily patched or configured
  4920.         for nonstandard hardware.
  4921.  
  4922.  
  4923. Function   03h  Versa-Spool print spooler
  4924. entry   AH      03h     Versa-Spool
  4925.         AL      00h     Return Signature
  4926.                 01h     Toggle Pause
  4927.                 02h     Clear Buffer
  4928.                 03h     Request Pause Condition
  4929.                 04h     Request Free Buffer Space
  4930.                 05h     Request Total Buffer Size
  4931.                 06h     Redirect Output to LPT1
  4932.                 07h     Redirect Output to LPT2
  4933.                 08h     Redirect Output to LPT3
  4934.                 09h     Request Output Device
  4935.                 0Ah     Request Output Speed
  4936.                 0Bh     Request Device Spooled Status
  4937.  
  4938. return  (AH=00h)        AX      1234h   if Versa-Spool is installed
  4939.                                         undefined if not installed
  4940.         (AH=01h)        AX      0001h   if paused
  4941.                                 0000h   if resumed
  4942.         (AH=02h)        AX      0302h   not cleared
  4943.                                 0000h   cleared
  4944.         (AH=03h)        AX      0001h   if paused
  4945.                                 0000h   if resumed
  4946.         (AH=04h)        AX      remaining buffer space (in Kbytes)
  4947.         (AH=05h)        AX      total buffer space (in Kbytes)
  4948.         (AH=06h)        AX      nothing
  4949.         (AH=07h)        AX      nothing
  4950.         (AH=08h)        AX      nothing
  4951.         (AH=09h)        AX      printer output (0..2)
  4952.         (AH=0Ah)        AX      output speed in CPS
  4953.         (AH=0Bh)        AX      0001h   is spooled
  4954.                                 0000h   otherwise
  4955.  
  4956. Function  0C0h  PC Magazine PCSPOOL - get printer status
  4957. entry   AH      0C0h
  4958.         DX      printer port to be used (0,1,2)
  4959. return  ES:BX   address of printer control block
  4960. note    PC Magazine, January 15, 1991. (Vol 10, Number 1)
  4961.  
  4962.  
  4963. Function  0C1h  PC Magazine PCSPOOL - add pause to spool queue
  4964. entry   AH      0C1h
  4965.         DX      printer port to be used (0,1,2)
  4966.         DS:SI   pointer to ASCIIZ string to display
  4967. return  AH      printer status
  4968.  
  4969.  
  4970. Function  0C2h  PC Magazine PCSPOOL - flush queue record
  4971. entry   AH      0C2h
  4972.         DX      printer port to be used (0,1,2)
  4973. return  AH      printer status
  4974.  
  4975.  
  4976. Function  0C3h  PC Magazine PCSPOOL - cancel printer queue
  4977. entry   AH      0C3h
  4978.         DX      printer port to be used (0,1,2)
  4979. return  AH      printer status
  4980.  
  4981.  
  4982. Function  0C4h  PC Magazine PCSPOOL - determine of spooler is active
  4983. entry   AH      0C4h
  4984. return  DI      0B0BFh  if PCSPOOL is loaded
  4985.         SI      segment of the PSP of the active PCSPOOL
  4986.  
  4987.  
  4988. ┌─────────────────────────────────────────────────────────────────────────────┐
  4989. │Interrupt 18h  ROM BASIC                                               3**11 │
  4990. └─────────────────────────────────────────────────────────────────────────────┘
  4991. (0:0060h)       Execute ROM BASIC at address 0F600h:0000h
  4992. entry   no parameters used
  4993. return  jumps into ROM BASIC on IBM systems
  4994. note 1) Often reboots a compatible.
  4995.      2) Used by Turbo C 1.5. 2.0 and later do not use it.
  4996.      3) On IBM systems, this interrupt is called if disk boot failure occurs.
  4997.      4) Video interrupt on DEC Rainbow.
  4998.      5) Digital Research's ROM-based implementation of DR-DOS uses int 18h as
  4999.         the initial entry vector into the operating system code. Note that
  5000.         some clone BIOSes may not properly implement int 18h in the ROM and
  5001.         use of DR-DOS ROMs may not always work.
  5002.      6) Maxon 286/HD laptop: called by BIOS power management routines to
  5003.         communicate with applications.
  5004.  
  5005.  
  5006.  
  5007. ┌─────────────────────────────────────────────────────────────────────────────┐
  5008. │Interrupt 19h  Bootstrap Loader / Extended Memory VDISK ID             3**12 │
  5009. └─────────────────────────────────────────────────────────────────────────────┘
  5010. (0:0064h)
  5011. entry   no parameters used
  5012. return  none
  5013. note 1) Reads track 0, sector 1 into address 0000h:7C00h, then transfers
  5014.         control to that address. If no diskette drive available, looks at
  5015.         absolute address C:800 for a valid hard disk or other ROM. If none,
  5016.         transfers to ROM-BASIC via int 18h or displays loader error message.
  5017.      2) Causes reboot of disk system if invoked while running. (no memory test
  5018.         performed).
  5019.      3) If location 0000:0472h does not contain the value 1234h, a memory test
  5020.         (POST) will be performed before reading the boot sector.
  5021.      4) VDISK from DOS 3.0+ traps this vector to determine when the CPU has
  5022.         shifted from protected mode to real mode. A detailed discussion can
  5023.         be found by Ray Duncan in PC Magazine, May 30, 1989.
  5024.      5) Reportedly, some versions of DOS 2.x and all versions of DOS 3.x+
  5025.         intercept int 19h in order to restore some interrupt vectors DOS takes
  5026.         over, in order to put the machine back to a cleaner state for the
  5027.         reboot, since the POST will not be run on the int 19h. These vectors
  5028.         are reported to be: 02h, 08h, 09h, 0Ah, 0Bh, 0Ch, 0Dh, 0Eh, 70h, 72h,
  5029.         73h, 74h, 75h, 76h, and 77h. After restoring these, it restores the
  5030.         original int 19h vector and calls int 19h.
  5031.      6) The system checks for installed ROMs by searching memory from 0C000h to
  5032.         the beginning of the BIOS, in 2k chunks. ROM memory is identified if it
  5033.         starts with the word 0AA55h. It is followed a one byte field length of
  5034.         the ROM (divided by 512). If ROM is found, the BIOS will call the ROM
  5035.         at an offset of 3 from the beginning. This feature was not supported in
  5036.         the earliest PC machines. The last task turns control over to the
  5037.         bootstrap loader (assuming the floppy controller is operational).
  5038.      7) 8255 port 60h bit 0 = 1 if booting from diskette.
  5039.  
  5040.  
  5041.  
  5042. ┌─────────────────────────────────────────────────────────────────────────────┐
  5043. │Interrupt 1Ah  Time of Day                                             3**13 │
  5044. └─────────────────────────────────────────────────────────────────────────────┘
  5045.  
  5046. (0:0068h)    1) Accesses the PC internal clock.
  5047.              2) This interrupt is not supported on some machines, such as
  5048.                 the HP150 PC.
  5049.              3) Some "turbo" BIOSes run the clock slower than normal in order
  5050.                 to throw off benchmark software, which usually uses int 1Ah
  5051.                 for timekeeping.
  5052.              4) Counts occur at the rate of 1193180/65536 counts/sec (about
  5053.                 18.2 per second).
  5054.  
  5055. Function 00h    Read System Timer Tick Counter                 (except PC)
  5056. entry   AH      00h
  5057. return  AL      00h     if clock was read or written (via AH=0,1) within the
  5058.                         current 24-hour period.
  5059.                 <>0     midnight was passed since last read
  5060.         CX:DX   32-bit tick count (high 16 bits in CX)
  5061. note 1) The returned value is the cumulative number of clock ticks since
  5062.         midnight. There are 18.2 clock ticks per second, or one every 54.92ms.
  5063.         When the counter reaches 1,573,040, it is cleared to zero, and the
  5064.         rollover flag is set.
  5065.      2) The rollover flag is cleared by this function call, so the flag will
  5066.         only be returned nonzero once per day.
  5067.      3) Int 1Ah/fn 01h can be used to set the counter to an arbitrary 32 bit
  5068.         value.
  5069.      4) This function does not return seconds/100 in DL. The best you can do
  5070.         is set it to zero (or any value <=99). This means that your DOS clock
  5071.         could be up to 1 second off from the BIOS clock, however the effect is
  5072.         not cumulative.
  5073.  
  5074.  
  5075. Function 01h    Set Clock Tick Counter Value                    (except PC)
  5076. entry   AH      01h
  5077.         CX:DX   32-bit high word/low word count of timer ticks
  5078. return  none
  5079. note 1) The clock ticks are incremented by timer interrupt at 18.2065 times
  5080.         per second or 54.9254 milliseconds/count. Therefore:
  5081.                 counts per second   18      (12h)
  5082.                 counts per minute   1092    (444h)
  5083.                 counts per hour     65543   (10011h)
  5084.                 counts per day      1573040 (1800B0h)
  5085.      2) The counter is zeroed when system is rebooted.
  5086.      3) Stores a 32-bit value in the clock tick counter.
  5087.      4) The rollover flag is cleared by this call.
  5088.  
  5089.  
  5090. Function 02h    Read Real Time Clock Time                       (AT and after)
  5091. entry   AH      02h
  5092. return  CH      hours in BCD
  5093.         CL      minutes in BCD
  5094.         DH      seconds in BCD
  5095.         DL      00h     standard time
  5096.                 01h     daylight savings time
  5097.         CF      0       if clock running
  5098.                 1       if clock not operating
  5099. note 1) Reads the current time from the CMOS time/date chip.
  5100.      2) Also for Leading Edge Model M.
  5101.      3) According to Phoenix this call will fail if the BIOS is "updating" its
  5102.         clock value. You should check the carry flag and retry if it is set
  5103.         following the call.
  5104.  
  5105.  
  5106. Function 03h    Set Real Time Clock Time                        (AT and after)
  5107. entry   AH      03h
  5108.         CH      hours in BCD
  5109.         CL      minutes in BCD
  5110.         DH      seconds in BCD
  5111.         DL      0 (clear) if standard time
  5112.                 1 (set)   if daylight savings time option
  5113. return  none
  5114. note 1) Sets the time in the CMOS time/date chip.
  5115.      2) Also for Leading Edge Model M.
  5116.  
  5117.  
  5118. Function 04h    Read Real Time Clock Date                       (AT and after)
  5119. entry   AH      04h
  5120. return  CH      century in BCD (19 or 20)
  5121.         CL      year in BCD
  5122.         DH      month in BCD
  5123.         DL      day in BCD
  5124.         CF      0 (clear) if clock is running
  5125.                 1 (set)   if clock is not operating
  5126. note 1) Reads the current date from the CMOS time/date chip.
  5127.      2) Also for Leading Edge Model M.
  5128.  
  5129.  
  5130. Function 05h    Set Real Time Clock Date                        (AT and after)
  5131. entry   AH      05h
  5132.         CH      century in BCD (19 or 20)
  5133.         CL      year in BCD
  5134.         DH      month in BCD
  5135.         DL      day in BCD
  5136. return  none
  5137. note 1) Sets the date in the CMOS time/date chip.
  5138.      2) Also for Leading Edge Model M.
  5139.  
  5140.  
  5141. Function 06h    Set Real Time Clock Alarm                       (AT and after)
  5142. entry   AH      06h
  5143.         CH      hours in BCD
  5144.         CL      minutes in BCD
  5145.         DH      seconds in BCD
  5146. return  CF      set if alarm already set or clock inoperable
  5147. note 1) Sets alarm in the CMOS date/time chip. Int 4Ah occurs at specified
  5148.         alarm time every 24hrs until reset with Int 1Ah/fn 07h.
  5149.      2) A side effect of this function is that the clock chip's interrupt
  5150.         level (IRQ8) is enabled.
  5151.      3) Only one alarm may be active at any given time.
  5152.      4) The program using this function must place the address of its interrupt
  5153.         handler for the alarm in the vector for Int 4Ah.
  5154.  
  5155.  
  5156. Function 07h    Reset Real Time Clock Alarm                     (AT and after)
  5157. entry   AH      07h
  5158. return  none
  5159. note 1) Cancels any pending alarm request on the CMOS date/time chip.
  5160.      2) This function does not disable the clock chip's interrupt level (IRQ8).
  5161.  
  5162.  
  5163. Function 08h    Set Real Time Clock Activated Power On Mode     (Convertible)
  5164. entry   AH      08h
  5165.         CH      hours in BCD
  5166.         CL      minutes in BCD
  5167.         DH      seconds in BCD
  5168.  
  5169.  
  5170. Function 09h    Read Real Time Clock Alarm Time and Status
  5171.                                                 (Convertible and PS/2 Model 30)
  5172. entry   AH      09h
  5173. return  CH      hours in BCD
  5174.         CL      minutes in BCD
  5175.         DH      seconds in BCD
  5176.         DL      alarm status:
  5177.                 00h     if alarm not enabled
  5178.                 01h     if alarm enabled but will not power up system
  5179.                 02h     if alarm will power up system
  5180.  
  5181.  
  5182. Function 0Ah    Read System-Timer Day Counter                          (PS/2)
  5183. entry   AH      0Ah
  5184. return  CF      set on error
  5185.         CX      count of days since Jan 1,1980
  5186. note    Returns the contents of the system's day counter.
  5187.  
  5188.  
  5189. Function 0Bh    Set System-Timer Day Counter                           (PS/2)
  5190. entry   AH      0Bh
  5191.         CX      count of days since Jan 1,1980
  5192. return  CF      set on error
  5193. note    Stores an arbitrary value in the system's day counter.
  5194.  
  5195.  
  5196. Function 80h    Set Up Sound Multiplexor                (PCjr) (Tandy 1000?)
  5197. entry   AH      80h
  5198.         AL      sound source
  5199.                 00h     source is 8253 timer chip, channel 2
  5200.                 01h     source is cassette input
  5201.                 02h     source is I/O channel "audio in" line
  5202.                 03h     source is TI sound generator chip
  5203. return  none
  5204. note    Sets up the source for tones that will appear on the PCjr's Audio Out
  5205.         bus line or RF modulator.
  5206.  
  5207.  
  5208. Function 1Ah    Read Time and Date                                 (AT&T 6300)
  5209. entry   AH      0FEh
  5210. return  BX      days count (1=Jan 1, 1984)
  5211.         CH      hours
  5212.         CL      minutes
  5213.         DH      seconds
  5214.         DL      hundredths
  5215. note    Day count in BX is unique to AT&T/Olivetti computers.
  5216.  
  5217.  
  5218.  
  5219. ┌─────────────────────────────────────────────────────────────────────────────┐
  5220. │Interrupt 1Bh  Control-Break                                           3**14 │
  5221. └─────────────────────────────────────────────────────────────────────────────┘
  5222. (0:006Ch)       This interrupt is called when the keyboard handler of the IBM
  5223.                 machines detects Ctrl and Break pressed at the same time. DOS
  5224.                 normally point this interrupt at its own Ctrl-Break handler.
  5225.  
  5226. note 1) If the break occurred while processing an interrupt, one or more
  5227.         end of interrupt commands must be send to the 8259 Programmable
  5228.         Interrupt Controller.
  5229.      2) All I/O devices should be reset in case an operation was underway at
  5230.         the time.
  5231.      3) It is normally pointed to an IRET during system initialization so that
  5232.         it does nothing, but some programs change it to return a Ctrl-C scan
  5233.         code and thus invoke int 23h.
  5234.  
  5235.  
  5236.  
  5237. ┌─────────────────────────────────────────────────────────────────────────────┐
  5238. │Interrupt 1Ch  Timer Tick                                              3**15 │
  5239. └─────────────────────────────────────────────────────────────────────────────┘
  5240. (0:0070h)
  5241. note 1) Taken 18.2065 times per second by the int 08h interrupt.
  5242.      2) Normally vectors to dummy IRET unless PRINT.COM has been installed.
  5243.      3) If an application moves the interrupt pointer, it is the responsibility
  5244.         of that application to save and restore all registers that may be
  5245.         modified.
  5246.      4) returns values at absolute address 40:6x (BIOS Data Area); number of
  5247.         ticks since midnight
  5248.         40:6C   word    timer counter high word
  5249.         40:6E   word    timer counter low word
  5250.      5) Ventura Publisher 2.0 grabs this interrupt and does not pass subsequent
  5251.         vector reassignments along. This causes problems with some TSRs and
  5252.         network software.
  5253.      6) When installing a user interrupt for int 1Ch, the external interrupts
  5254.         must be disabled before the vector is altered. If a timer interrupt
  5255.         occurs between the setting of the offset and segment, an incorrect
  5256.         address will result.
  5257.  
  5258.  
  5259. ┌─────────────────────────────────────────────────────────────────────────────┐
  5260. │Interrupt 1Dh  Vector of Video Initialization Parameters               3**16 │
  5261. └─────────────────────────────────────────────────────────────────────────────┘
  5262. (0:0074h)       This doubleword address points to 3 sets of 16-bytes containing
  5263.                 data to initialize for video modes for video modes 0 & 1 (40
  5264.                 column), 2 & 3 (80 column), and 4, 5 & 6 (graphics) on the
  5265.                 Motorola 6845 CRT controller chip.
  5266.  6845 registers:
  5267.         R0      horizontal total                (horizontal sync in characters)
  5268.         R1      horizontal displayed                      (characters per line)
  5269.         R2      horizontal sync position           (move display left or right)
  5270.         R3      sync width         (vertical and horizontal pulse: 4-bits each)
  5271.         R4      vertical total                          (total character lines)
  5272.         R5      vertical adjust                (adjust for 50 or 60 Hz refresh)
  5273.         R6      vertical displayed                   (lines of chars displayed)
  5274.         R7      vertical sync position               (lines shifted up or down)
  5275.         R8      interlace (bits 4 and 5) and skew (bits 6 and 7)
  5276.         R9      max scan line addr               (scan lines per character row)
  5277.         R10     cursor start                     (starting scan line of cursor)
  5278.         R11     cursor stop                        (ending scan line of cursor)
  5279.         R12     video memory start address high byte                   (6 bits)
  5280.         R13     video memory start address low byte                    (8 bits)
  5281.         R14     cursor address high byte                               (6 bits)
  5282.         R15     cursor address low byte                                (8 bits)
  5283.  
  5284.  6845 Video Init Tables:
  5285.         table for modes 0 and 1   \
  5286.         table for modes 2 and 3    \ each table is 16 bytes long and
  5287.         table for modes 4,5, and 6 / contains values for 6845 registers
  5288.         table for mode 7          /
  5289.       4 words   size of video RAM for modes 0/1, 2/3, 4/5, and 6/7
  5290.       8 bytes   number of columns in each mode
  5291.       8 bytes   video controller mode byte for each mode
  5292. note 1) There are 4 separate tables, and all 4 must be initialized if all
  5293.         video modes will be used.
  5294.      2) The power-on initialization code of the computer points this vector
  5295.         to the ROM BIOS video routines.
  5296.      3) IBM recommends that if this table needs to be modified, it should be
  5297.         copied into RAM and only the necessary changes made.
  5298.  
  5299.  
  5300.  
  5301.  
  5302. ┌─────────────────────────────────────────────────────────────────────────────┐
  5303. │Interrupt 1Eh  Vector of Diskette Controller Parameters                3**17 │
  5304. └─────────────────────────────────────────────────────────────────────────────┘
  5305. (0:0078h)       Dword address points to data base table that is used by BIOS.
  5306.                 Default location is at 0F000:0EFC7h. 11-byte table format:
  5307.           bytes:
  5308.                 00h     4-bit step rate, 4-bit head unload time
  5309.                 01h     7-bit head load time, 1-bit DMA flag
  5310.                 02h     54.9254 ms ticks - delay til motor off (36-38 typical)
  5311.                 03h     sector size:
  5312.                         00h     128 bytes
  5313.                         01h     256 bytes
  5314.                         02h     512 bytes
  5315.                         03h     1024 bytes
  5316.                 04h     last sector on track                  (8 or 9 typical)
  5317.                 05h     inter-sector gap on read/write            (42 typical)
  5318.                 06h     data length for DMA transfers           (0FFh typical)
  5319.                 07h     gap length between sectors for format     (80 typical)
  5320.                 08h     sector fill byte for format             (0F6h typical)
  5321.                 09h     head settle time (in milliseconds)  (15 to 25 typical)
  5322.                         DOS 1.0   0
  5323.                         DOS 1.10  0
  5324.                         DOS 2.10  15
  5325.                         DOS 3.1   1
  5326.                 0Ah     motor start time (in 1/8 sec intervals)  (2-4 typical)
  5327.                         DOS 2.10  2
  5328. note 1) This vector is pointed to the ROM BIOS diskette tables on system
  5329.         initialization
  5330.      2) IBM recommends that if this table needs to be modified, it should be
  5331.         copied into RAM and only the necessary changes made.
  5332.      3) Some versions of DOS 3.2 may contain a bug. DOS 3.2 assumes that the
  5333.         dword at 0070:0F37 contains the address of the diskette parameter
  5334.         block and changes values in that block. The location does contain a
  5335.         copy of the value at 0:78 (int 1Eh, DISK_POINTER) if DOS is booted from
  5336.         diskette, but when booted from the hard disk, the location contains
  5337.         0:0. This leads to strange things, especially when running under a
  5338.         debugger since DOS overwrites parts of the interrupt vectors for
  5339.         interrupts 1 to 3. The solution to the problem is to either upgrade
  5340.         to DOS 3.3 or to copy the disk parameter vector to 70:0F37 before
  5341.         running or at the start of your program.
  5342.  
  5343.  
  5344.  
  5345. ┌─────────────────────────────────────────────────────────────────────────────┐
  5346. │Interrupt 1Fh  Ptr to Graphics Character Extensions (Graphics Set 2)   3**18 │
  5347. └─────────────────────────────────────────────────────────────────────────────┘
  5348. (0:007Ch)       This is the pointer to data used by the ROM video routines to
  5349.                 display characters above ASCII 127 while in CGA medium and high
  5350.                 res graphics modes.
  5351.  
  5352. note 1) Doubleword address points to 1K table composed of 28 8-byte character
  5353.         definition bit-patterns. First byte of each entry is top row, last byte
  5354.         is bottom row.
  5355.      2) The first 128 character patterns are located in system ROM.
  5356.      3) This vector is set to 000:0 at system initialization.
  5357.      4) Used by DOS' external GRAFTABL command.
  5358.  
  5359.  
  5360.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  5361.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  5362. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  5363.                      ISBN 1-878830-02-3 (disk-based text)
  5364.                     Copyright (c) 1987, 1992 Dave Williams
  5365.                         ┌─────────────────────────────┐
  5366.                         │ Shareware Version, 03/16/92 │
  5367.                         │  Please Register Your Copy  │
  5368.                         └─────────────────────────────┘
  5369.  
  5370.  
  5371.                            C H A P T E R    F O U R
  5372.  
  5373.                        DOS INTERRUPTS AND FUNCTION CALLS
  5374.  
  5375.        note: The registered version of this chapter is twice this size.
  5376.  
  5377.  
  5378.  
  5379. DOS REGISTERS├─────────────────────────────────────────────────────────────────
  5380.  
  5381.  DOS uses the following registers, pointers, and flags when it executes
  5382. interrupts and function calls:
  5383. ┌───────────────────┬──────────┬───────────────────────────────────────────────┐
  5384. │GENERAL REGISTERS  │ register │                  definition                   │
  5385. │                   ├──────────┼───────────────────────────────────────────────┤
  5386. │                   │    AX    │  accumulator (16 bit)                         │
  5387. │                   │    AH    │  accumulator high-order byte (8 bit)          │
  5388. │                   │    AL    │  accumulator low order byte (8 bit)           │
  5389. │                   │    BX    │  base (16 bit)                                │
  5390. │                   │    BH    │  base high-order byte (8 bit)                 │
  5391. │                   │    BL    │  base low-order byte (8 bit)                  │
  5392. │                   │    CX    │  count (16 bit)                               │
  5393. │                   │    CH    │  count high order byte (8 bit)                │
  5394. │                   │    CL    │  count low order byte (8 bit)                 │
  5395. │                   │    DX    │  data (16 bit)                                │
  5396. │                   │    DH    │  date high order byte (8 bit)                 │
  5397. │                   │    DL    │  data low order byte (8 bit)                  │
  5398. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  5399. │SEGMENT REGISTERS  │ register │                  definition                   │
  5400. │                   ├──────────┼───────────────────────────────────────────────┤
  5401. │                   │    CS    │  code  segment (16 bit)                       │
  5402. │                   │    DS    │  data  segment (16 bit)                       │
  5403. │                   │    SS    │  stack segment (16 bit)                       │
  5404. │                   │    ES    │  extra segment (16 bit)                       │
  5405. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  5406. │INDEX REGISTERS    │ register │                  definition                   │
  5407. │                   ├──────────┼───────────────────────────────────────────────┤
  5408. │                   │    DI    │  destination index (16 bit)                   │
  5409. │                   │    SI    │  stack       index (16 bit)                   │
  5410. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  5411. │SEGMENT REGISTERS  │ register │                  definition                   │
  5412. │                   ├──────────┼───────────────────────────────────────────────┤
  5413. │                   │    CS    │  code  segment (16 bit)                       │
  5414. │                   │    DS    │  data  segment (16 bit)                       │
  5415. │                   │    SS    │  stack segment (16 bit)                       │
  5416. │                   │    ES    │  extra segment (16 bit)                       │
  5417. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  5418. │INDEX REGISTERS    │ register │                  definition                   │
  5419. │                   ├──────────┼───────────────────────────────────────────────┤
  5420. │                   │    DI    │  destination index (16 bit)                   │
  5421. │                   │    SI    │  stack       index (16 bit)                   │
  5422. ├───────────────────┼──────────┼───────────────────────────────────────────────┤
  5423. │POINTERS           │ register │                  definition                   │
  5424. │                   ├──────────┼───────────────────────────────────────────────┤
  5425. │                   │    SP    │  stack pointer (16 bit)                       │
  5426. │                   │    BP    │  base pointer (16 bit)                        │
  5427. │                   │    IP    │  instruction pointer (16 bit)                 │
  5428. ├───────────────────┴──────────┴───────────────────────────────────────────────┤
  5429. │FLAGS                   AF, CF, DF, IF, OF, PF, SF, TF, ZF                    │
  5430. └──────────────────────────────────────────────────────────────────────────────┘
  5431.  
  5432.  These registers, pointers, and flags are "lowest common denominator" 8088-8086
  5433. CPU oriented. DOS makes no attempt to use any of the special or enhanced
  5434. instructions availible on the later CPUs which will execute 8088 code, such as
  5435. the 80186, 80286, 80386, or NEV V20, V30, V40, or V50.
  5436.  
  5437.  When DOS takes control after a function call, it switches to an internal
  5438. stack. Registers which are not used to return information (other than AX) are
  5439. preserved. The calling program's stack must be large enough to accomodate the
  5440. interrupt system - at least 128 bytes in addition to other interrupts.
  5441.  DOS actually maintains three stacks -
  5442. stack 1: 384 bytes (in DOS 3.1)
  5443.          for functions 00h and for 0Dh and up, and for ints 25h and 26h.
  5444.  
  5445. stack 2: 384 bytes (in DOS 3.1)
  5446.          for function calls 01h through 0Ch.
  5447.  
  5448. stack 3: 48 bytes (in DOS 3.1)
  5449.          for functions 0Dh and above. This stack is the initial stack used by
  5450.          the int 21h handler before it decides which of the other two to use.
  5451.          It is also used by function 59h (get extended error), and 01h to 0Ch if
  5452.          they are called during an int 24h (critical error) handler. Functions
  5453.          33h (get/set break flag), 50h (set process ID), 51h (get process ID)
  5454.          and 62h (get PSP address) do not use any DOS stack under DOS 3.x
  5455.          (under 2.x, 50h and 51h use stack number 2).
  5456.  
  5457.  IBM and Microsoft made a change back in DOS 3.0 or 3.1 to reduce the size of
  5458. DOS. They reduced the space allocated for scratch areas when interrupts are
  5459. being processed. The default seems to vary with the DOS version and the
  5460. machine, but 8 stack frames seems to ring a bell. That means that if you get
  5461. more than 8 interrupts at the same time, clock, disk, printer spooler,
  5462. keyboard, com port, etc., the system will crash. It seems to happen usually on
  5463. a network. STACKS=16,256 means allow 16 interrupts to interrupt each other and
  5464. allow 256 bytes for each for scratch area. Eight is marginal.
  5465.  
  5466.  DOS 3.2 does some different stack switching than previous versions. The
  5467. interrupts which are switched are 02h, 08h, 09h, 0Ah, 0Bh, 0Ch, 0Dh, 0Eh, 70h,
  5468. 72h, 73h, 74h, 75h, 76h, and 77h. DOS 3.2 has a special check in the
  5469. initialization code for a PCjr and don't enable stack switching on that machine.
  5470.  
  5471.  
  5472.  
  5473. INTERRUPTS├────────────────────────────────────────────────────────────────────
  5474.  
  5475.  Microsoft recommends that a program wishing to examine or set the contents of
  5476. any interrupt vector use the DOS function calls 35h and 25h provided for those
  5477. purposes and avoid referencing the interrupt vector locations directly.
  5478.  DOS reserves interrupt numbers 20h to 3Fh for its own use. This means absolute
  5479. memory locations 80h to 0FFh are reserved by DOS. The defined interrupts are as
  5480. follows with all values in hexadecimal.
  5481.  
  5482.  
  5483. ┌─────────────────────────────────────────────────────────────────────────────┐
  5484. │Interrupt 21h  Function Call Request                                         │
  5485. └─────────────────────────────────────────────────────────────────────────────┘
  5486. (0:0084h)
  5487.  DOS provides a wide variety of function calls for character device I/O, file
  5488. management, memory management, date and time functions,execution of other
  5489. programs, and more. They are grouped as follows:
  5490.  
  5491.           call              description
  5492.         00h             program terminate
  5493.         01h-0Ch         character device I/O, CP/M compatibility format
  5494.         0Dh-24h         file management,      CP/M compatibility format
  5495.         25h-26h         nondevice functions,  CP/M compatibility format
  5496.         27h-29h         file management,      CP/M compatibility format
  5497.         2Ah-2Eh         nondevice functions,  CP/M compatibility format
  5498.         2Fh-38h         extended functions
  5499.         39h-3Bh         directory group
  5500.         3Ch-46h         extended file management
  5501.         47h             directory group
  5502.         48h-4Bh         extended memory management
  5503.         54h-57h         extended functions
  5504.         5Eh-5Fh         networking
  5505.         60h-62h         extended functions
  5506.         63h-66h         enhanced foreign language support
  5507.  
  5508.  
  5509. List of DOS services:   * = undocumented
  5510.         00h     terminate program
  5511.         01h     get keyboard input
  5512.         02h     display character to STDIO
  5513.         03h     get character from STDAUX
  5514.         04h     output character to STDAUX
  5515.         05h     output character to STDPRN
  5516.         06h     direct console I/O - keyboard to screen
  5517.         07h     get char from std I/O without echo
  5518.         08h     get char from std I/O without echo, checks for ^C
  5519.         09h     display a string to STDOUT
  5520.         0Ah     buffered keyboard input
  5521.         0Bh     check STDIN status
  5522.         0Ch     clear keyboard buffer and invoke keyboard function
  5523.         0Dh     flush all disk buffers
  5524.         0Eh     select disk
  5525.         0Fh     open file with File Control Block
  5526.         10h     close file opened with File Control Block
  5527.         11h     search for first matching file entry
  5528.         12h     search for next matching file entry
  5529.         13h     delete file specified by File Control Block
  5530.         14h     sequential read from file specified by File Control Block
  5531.         15h     sequential write to file specified by File Control Block
  5532.         16h     find or create firectory entry for file
  5533.         17h     rename file specified by file control block
  5534.         18h*    unknown
  5535.         19h     return current disk drive
  5536.         1Ah     set disk transfer area (DTA)
  5537.         1Bh     get current disk drive FAT
  5538.         1Ch     get disk FAT for any drive
  5539.         1Dh*    unknown
  5540.         1Eh*    unknown
  5541.         1Fh*    read DOS disk block, default drive
  5542.         20h*    unknown
  5543.         21h     random read from file specified by FCB
  5544.         22h     random write to file specified by FCB
  5545.         23h     return number of records in file specified by FCB
  5546.         24h     set relative file record size field for file specified by FCB
  5547.         25h     set interrupt vector
  5548.         26h     create new Program Segment Prefix (PSP)
  5549.         27h     random file block read from file specified by FCB
  5550.         28h     random file block write to file specified by FCB
  5551.         29h     parse the command line for file name
  5552.         2Ah     get the system date
  5553.         2Bh     set the system date
  5554.         2Ch     get the system time
  5555.         2Dh     set the system time
  5556.         2Eh     set/clear disk write VERIFY
  5557.         2Fh     get the Disk Transfer Address (DTA)
  5558.         30h     get DOS version number
  5559.         31h     TSR, files opened remain open
  5560.         32h*    read DOS Disk Block
  5561.         33h     get or set Ctrl-Break
  5562.         34h*    INDOS  Critical Section Flag
  5563.         35h     get segment and offset address for an interrupt
  5564.         36h     get free disk space
  5565.         37h*    get/set option marking character (SWITCHAR)
  5566.         38h     return country-dependent information
  5567.         39h     create subdirectory
  5568.         3Ah     remove subdirectory
  5569.         3Bh     change current directory
  5570.         3Ch     create and return file handle
  5571.         3Dh     open file and return file handle
  5572.         3Eh     close file referenced by file handle
  5573.         3Fh     read from file referenced by file handle
  5574.         40h     write to file referenced by file handle
  5575.         41h     delete file
  5576.         42h     move file pointer (move read-write pointer for file)
  5577.         43h     set/return file attributes
  5578.         44h     device IOCTL (I/O control) info
  5579.         45h     duplicate file handle
  5580.         46h     force a duplicate file handle
  5581.         47h     get current directory
  5582.         48h     allocate memory
  5583.         49h     release allocated memory
  5584.         4Ah     modify allocated memory
  5585.         4Bh     load or execute a program
  5586.         4Ch     terminate prog and return to DOS
  5587.         4Dh     get return code of subprocess created by 4Bh
  5588.         4Eh     find first matching file
  5589.         4Fh     find next matching file
  5590.         50h*    set new current Program Segment Prefix (PSP)
  5591.         51h*    puts current PSP into BX
  5592.         52h*    pointer to the DOS list of lists
  5593.         53h*    translates BPB (Bios Parameter Block, see below)
  5594.         54h     get disk verification status (VERIFY)
  5595.         55h*    create PSP: similar to function 26h
  5596.         56h     rename a file
  5597.         57h     get/set file date and time
  5598.         58h     get/set allocation strategy             (DOS 3.x)
  5599.         59h     get extended error information
  5600.         5Ah     create a unique filename
  5601.         5Bh     create a DOS file
  5602.         5Ch     lock/unlock file contents
  5603.         5Dh*    network
  5604.         5Eh*    network printer
  5605.         5Fh*    network redirection
  5606.         60h*    parse pathname
  5607.         61h*    unknown
  5608.         62h     get program segment prefix (PSP)
  5609.         63h*    get lead byte table                     (DOS 2.25)
  5610.         64h*    unknown
  5611.         65h     get extended country information        (DOS 3.3)
  5612.         66h     get/set global code page table          (DOS 3.3)
  5613.         67h     set handle count                        (DOS 3.3)
  5614.         68h     commit file                             (DOS 3.3)
  5615.         69h     disk serial number                      (DOS 4.0)
  5616.         6Ah     unknown
  5617.         6Bh     unknown
  5618.         6Ch     extended open/create                    (DOS 4.0)
  5619.  
  5620.  
  5621. CALLING THE DOS SERVICES├──────────────────────────────────────────────────────
  5622.  
  5623.  The DOS services are invoked by placing the number of the desired function in
  5624. register AH, subfunction in AL, setting the other registers to any specific
  5625. requirements of the function, and invoking int 21h.
  5626.  
  5627.  On return, the requested service will be performed if possible. Most codes
  5628. will return an error; some return more information. Details are contained in
  5629. the listings for the individual functions. Extended error return may be
  5630. obtained by calling function 59h (see 59h).
  5631.  
  5632.  Register settings listed are the ones used by DOS. Some functions will return
  5633. with garbage values in unused registers. Do not test for values in unspecified
  5634. registers; your program may exhibit odd behavior.
  5635.  
  5636.  DS:DX pointers are the data segment register (DS) indexed to the DH and DL
  5637. registers (DX). DX always contains the offset address, DS contains the segment
  5638. address.
  5639.  
  5640.  The File Control Block services (FCB services) were part of DOS 1.0. Since
  5641. the release of DOS 2.0, Microsoft has recommended that these services not be
  5642. used. A set of considerably more enhanced services (handle services) were
  5643. introduced with DOS 2.0. The handle services provide support for wildcards and
  5644. subdirectories, and enhanced error detection via function 59h.
  5645.  
  5646.  The data for the following calls was compiled from various Intel, Microsoft,
  5647. IBM, and other publications. There are many subtle differences between MSDOS
  5648. and PCDOS and between the individual versions. Differences between the
  5649. versions are noted as they occur.
  5650.  
  5651.  There are various ways of calling the DOS functions. For all methods, the
  5652. function number is loaded into register AH, subfunctions and/or parameters are
  5653. loaded into AL or other registers, and call int 21 by one of the following
  5654. methods:
  5655.  A) call interrupt 21h directly  (the recommended procedure)
  5656.  B) perform a long call to offset 50h in the program's PSP.
  5657.      1) This method will not work under DOS 1.x
  5658.      2) Though recommended by Microsoft for DOS 2.0, this method takes more
  5659.         time and is no longer recommended.
  5660.  C) place the function number in CL and perform an intrasegment call to
  5661.     location 05h in the current code segment. This location contains a long
  5662.     call to the DOS function dispatcher.
  5663.      1) IBM recommends this method be used only when using existing programs
  5664.         written for different calling conventions. (such as converting CP/M
  5665.         programs). This method should be avoided unless you have some specific
  5666.         use for it.
  5667.      2) AX is always destroyed by this method.
  5668.      3) This method is valid only for functions 00h-24h.
  5669.  
  5670.  There are also various ways of exiting from a program. (assuming it is not
  5671. intended to be a TSR). All methods except call 4Ch must ensure that the
  5672. segment register contains the segment address of the PSP.
  5673.  A) Interrupt 21h, function 4Ch (Terminate with Result Code). This is the
  5674.     "official" recommended method of returning to DOS.
  5675.  B) Interrupt 21h, function 00h (Exit Program). This is the early style
  5676.     int 21 function call. It simply calls int 20h.
  5677.  C) Interrupt 20h (Exit).
  5678.  D) A JMP instruction to offset 00h (int 20h vector) in the Program Segment
  5679.     Prefix. This is just a roundabout method to call int 20h. This method
  5680.     was set up in DOS 1.0 for ease of conversion for CP/M programs. It is no
  5681.     longer recommended for use.
  5682.  E) A JMP instruction to offset 05h (int 21 vector) in the Program Segment
  5683.     Prefix, with AH set to 00h or 4Ch. This is another CP/M type function.
  5684.  
  5685.  
  5686.  
  5687.  
  5688. INT 21H   DOS services
  5689.           Function (hex)
  5690.  
  5691. * Indicates Functions not documented in the IBM DOS Technical Reference.
  5692.  Note some functions have been documented in other Microsoft or licensed OEM
  5693. documentation.
  5694.  
  5695.  
  5696. Function  00h   Terminate Program
  5697.       Ends program, updates, FAT, flushes buffers, restores registers
  5698. entry   AH      00h
  5699.         CS      segment address of PSP
  5700. return  none
  5701. note 1) Program must place the segment address of the PSP control block in CS
  5702.         before calling this function.
  5703.      2) The terminate, ctrl-break,and critical error exit addresses (0Ah, 0Eh,
  5704.         12h) are restored to the values they had on entry to the terminating
  5705.         program, from the values saved in the program segment prefix at
  5706.         locations PSP:000Ah, PSP:000Eh, and PSP:0012h.
  5707.      3) All file buffers are flushed and the handles opened by the process are
  5708.         closed.
  5709.      4) Any files that have changed in length and are not closed are not
  5710.         recorded properly in the directory.
  5711.      5) Control transfers to the terminate address.
  5712.      6) This call performs exactly the same function as int 20h.
  5713.      7) All memory used by the program is returned to DOS.
  5714.  
  5715.  
  5716. Function  01h     Get Keyboard Input
  5717.         Waits for char at STDIN (if nescessary), echoes to STDOUT
  5718. entry   AH      01h
  5719. return  AL      ASCII character from STDIN (8 bits)
  5720. note 1) Checks char for Ctrl-C, if char is Ctrl-C, executes int 23h.
  5721.      2) For function call 06h, extended ASCII codes require two function calls.
  5722.         The first call returns 00h as an indicator that the next call will be an
  5723.         extended ASCII code.
  5724.      3) Input and output are redirectable. If redirected, there is no way to
  5725.         detect EOF.
  5726.  
  5727.  
  5728. Function  02h   Display Output
  5729.       Outputs char in DL to STDOUT
  5730. entry   AH      02h
  5731.         DL      8 bit data (usually ASCII character)
  5732. return  none
  5733. note 1) If char is 08 (backspace) the cursor is moved 1 char to the left
  5734.         (nondestructive backspace).
  5735.      2) If Ctrl-C is detected after input, int 23h is executed.
  5736.      3) Input and output are redirectable. If redirected, there is no way to
  5737.         detect disk full.
  5738.  
  5739.  
  5740. Function  03h   Auxiliary Input
  5741.       Get (or wait until) character from STDAUX
  5742. entry   AH      03h
  5743. return  AL      char from auxiliary device
  5744. note 1) AUX, COM1, COM2 is unbuffered and not interrupt driven
  5745.      2) This function call does not return status or error codes. For greater
  5746.         control it is recommended that you use ROM BIOS routine (int 14h) or
  5747.         write an AUX device driver and use IOCTL.
  5748.      3) At startup, PC-DOS initializes the first auxiliary port (COM1) to 2400
  5749.         baud, no parity, one stop bit, and an 8-bit word. MSDOS may differ.
  5750.      4) If Ctrl-C is has been entered from STDIN, int 23h is executed.
  5751.  
  5752.  
  5753. Function  04h   Auxiliary Output
  5754.       Write character to STDAUX
  5755. entry   AH      04h
  5756.         DL      char to send to AUX
  5757. return  none
  5758. note 1) This function call does not return status or error codes. For greater
  5759.         control it is recommended that you use ROM BIOS routine (int 14h) or
  5760.         write an AUX device driver and use IOCTL.
  5761.      2) If Ctrl-C is has been entered from STDIN, int 23h is executed.
  5762.      3) Default is COM1 unless redirected by DOS.
  5763.      4) If the device is busy, this function will wait until it is ready.
  5764.  
  5765.  
  5766. Function  05h   Printer Output
  5767.       Write character to STDPRN
  5768. entry   AL      05h
  5769.         DL      character to send
  5770. return  none
  5771. note 1) If Ctrl-C is has been entered from STDIN, int 23h is executed.
  5772.      2) Default is PRN or LPT1 unless redirected with the MODE command.
  5773.      3) If the printer is busy, this function will wait until it is ready.
  5774.  
  5775.  
  5776. Function  06h   Direct Console I/O
  5777.       Get character from STDIN; echo character to STDOUT
  5778. entry   AH      06h
  5779.         DL      0FFh for console input, or 00h-0FEh for console output
  5780. return  ZF      set   (1) = no character
  5781.                 clear (0) = character recieved
  5782.         AL      character
  5783. note 1) Extended ASCII codes require two function calls. The first call returns
  5784.         00h to indicate the next call will return an extended code.
  5785.      2) If DL is not 0FFh, DL is assumed to have a valid character that is
  5786.         output to STDOUT.
  5787.      3) This function does not check for Ctrl-C or Ctrl-PrtSc.
  5788.      4) Does not echo input to screen
  5789.      5) If I/O is redirected, EOF or disk full cannot be detected.
  5790.  
  5791.  
  5792. Function  07h   Direct Console Input Without Echo         (does not check BREAK)
  5793.       Get or wait for char at STDIN, returns char in AL
  5794. entry   AH      07h
  5795. return  AL      character from standard input device
  5796. note 1) Extended ASCII codes require two function calls. The first call returns
  5797.         00h to indicate the next call will return an extended code.
  5798.      2) No checking for Ctrl-C or Ctrl-PrtSc is done.
  5799.      3) Input is redirectable.
  5800.  
  5801.  
  5802. Function  08h   Console Input Without Echo                (checks BREAK)
  5803.       Get or Wait for char at STDIN, return char in AL
  5804. entry   AH      08h
  5805. return  AL      char from standard input device
  5806. note 1) Char is checked for ctrl-C. If ctrl-C is detected, executes int 23h.
  5807.      2) For function call 08h, extended ASCII characters require two function
  5808.         calls. The first call returns 00h to signify an extended ASCII code.
  5809.         The next call returns the actual code.
  5810.      3) Input is redirectable. If redirected, there is no way to check EOF.
  5811.  
  5812.  
  5813. Function  09h   Print String
  5814.       Outputs Characters in the Print String to the STDOUT
  5815. entry   AH      09h
  5816.         DS:DX   pointer to the Character String to be displayed
  5817. return  none
  5818. note 1) The character string in memory must be terminated by a $ (24h)
  5819.         The $ is not displayed.
  5820.      2) Output to STDOUT is the same as function call 02h.
  5821.  
  5822.  
  5823. Function  0Ah   Buffered Keyboard Input
  5824.       Reads characters from STDIN and places them in the buffer beginning
  5825.       at the third byte.
  5826. entry   AH      0Ah
  5827.         DS:DX   pointer to an input buffer
  5828. return  none
  5829. note 1) Min buffer size = 1, max = 255
  5830.      2) Char is checked for ctrl-C. If ctrl-C is detected, executes int 23h.
  5831.      3) Format of buffer DX:
  5832.         byte       contents
  5833.          1      Maximum number of chars the buffer will take, including CR.
  5834.                 Reading STDIN and filling the buffer continues until a carriage
  5835.                 return (<Enter> or 0Dh) is read. If the buffer fills to one less
  5836.                 than the maximum number the buffer can hold, each additional
  5837.                 number read is ignored and ASCII 7 (BEL) is output to the
  5838.                 display until a carriage return is read. (you must set this
  5839.                 value)
  5840.          2      Actual number of characters received, excluding the carriage
  5841.                 return, which is always the last character. (the function sets
  5842.                 this value)
  5843.          3-n    Characters received are placed into the buffer starting here.
  5844.                 Buffer must be at least as long as the number in byte 1.
  5845.      4) Input is redirectable. If redirected, there is no way to check EOF.
  5846.      5) The string may be edited with the standard DOS editing commands as it
  5847.         is being entered.
  5848.      6) Extended ASCII characters are stored as 2 bytes, the first byte being
  5849.         zero.
  5850.  
  5851.  
  5852. Function  0Bh   Check Standard Input (STDIN) status
  5853.       Checks for character availible at STDIN
  5854. entry   AH      0Bh
  5855. return  AL      0FFh    if a character is availible from STDIN
  5856.                 00h     if no character is availible from STDIN
  5857. note 1) Checks for Ctrl-C. If Ctrl-C is detected, int 23h is executed
  5858.      2) Input can be redirected.
  5859.      3) Checks for character only, it is not read into the application
  5860.      4) IBM reports that this call does not work properly under the DOSSHELL
  5861.         program in DOS 4.00 and 4.01. DOSSHELL will return all zeroes. This
  5862.         function works correctly from the command line or application.
  5863.  
  5864.  
  5865. Function  0Ch   Clear Keyboard Buffer & Invoke a Keyboard Function       (FCB)
  5866.       Dumps buffer, executes function in AL (01h,06h,07h,08h,0Ah only)
  5867. entry   AH      0Ch
  5868.         AL      function number (must be 01h, 06h, 07h, 08h, or 0Ah)
  5869. return  AL      00h     buffer was flushed, no other processing performed
  5870.                 other   any other value has no meaning
  5871. note 1) Forces system to wait until a character is typed.
  5872.      2) Flushes all typeahead input, then executes function specified by AL (by
  5873.         moving it to AH and repeating the int 21 call).
  5874.      3) If AL contains a value not in the list above, the keyboard buffer is
  5875.         flushed and no other action is taken.
  5876.  
  5877.  
  5878. Function  0Dh   Disk Reset
  5879.       Flushes all currently open file buffers to disk
  5880. entry   AH      0Dh
  5881. return          none
  5882. note 1) Does not close files. Does not update directory entries; files changed
  5883.         in size but not closed are not properly recorded in the directory
  5884.      2) Sets DTA address to DS:0080h
  5885.      3) Should be used before a disk change, Ctrl-C handlers, and to flush
  5886.         the buffers to disk.
  5887.  
  5888.  
  5889. Function  0Eh   Select Disk
  5890.       Sets the drive specified in DL (if valid) as the default drive
  5891. entry   AL      0Eh
  5892.         DL      new default drive number (0=A:,1=B:,2=C:,etc.)
  5893. return  AL      total number of logical drives (not nescessarily physical)
  5894. note 1) For DOS 1.x and 2.x, the minimum value for AL is 2.
  5895.      2) For DOS 3.x and 4.x, the minimum value for AL is 5.
  5896.      3) The drive number returned is not nescessarily a valid drive.
  5897.      4) For DOS 1.x: 16 logical drives are availible, A-P.
  5898.         For DOS 2.x: 63 logical drives are availible. (Letters are only used for
  5899.                      the first 26 drives. If more than 26 logical drives are
  5900.                      used, further drive letters will be other ASCII characters
  5901.                      ie {,], etc.
  5902.         For DOS 3.x: 26 logical drives are availible, A-Z.
  5903.         For DOS 4.x: 26 logical drives are availible, A-Z.
  5904.  
  5905.  
  5906. Function  0Fh   Open Disk File                                            (FCB)
  5907.       Searches current directory for specified filename and opens it
  5908. entry   AH      0Fh
  5909.         DS:DX   pointer to an unopened FCB
  5910. return  AL      00h     if file found
  5911.                 0FFh    if file not not found
  5912. note 1) If the drive code was 0 (default drive) it is changed to the actual
  5913.         drive used (1=A:,2=B:,3=C:, etc). This allows changing the default drive
  5914.         without interfering with subsequent operations on this file.
  5915.      2) The current block field (FCB bytes C-D, offset 0Ch) is set to zero.
  5916.      3) The size of the record to be worked with (FCB bytes E-F, offset 0Eh) is
  5917.         set to the system default of 80h. The size of the file (offset 10h) and
  5918.         the date (offset 14h) are set from information obtained in the root
  5919.         directory. You can change the default value for the record size (FCB
  5920.         bytes E-F) or set the random record size and/or current record field.
  5921.         Perform these actions after the open but before any disk operations.
  5922.      4) The file is opened in compatibility mode.
  5923.      5) Microsoft recommends handle function call 3Dh be used instead.
  5924.      6) This call is also used by the APPEND command in DOS 3.2+
  5925.      7) Before performing a sequential disk operation on the file, you must
  5926.         set the Current Record field (offset 20h). Before performing a random
  5927.         disk operation on the file, you must set the Relative Record field
  5928.         (offset 21h). If the default record size of 128 bytes is incorrect, set
  5929.         it to the correct value.
  5930.  
  5931.  
  5932. Function  10h  Close File                                              (FCB)
  5933.      Closes a File After a File Write
  5934. entry   AH      10h
  5935.         DS:DX   pointer to an opened FCB
  5936. return  AL      00h     if the file is found and closed
  5937.                 0FFh    if the file is not found in the current directory
  5938. note 1) This function call must be done on open files that are no longer needed,
  5939.         and after file writes to insure all directory information is updated.
  5940.      2) If the file is not found in its correct position in the current
  5941.         directory, it is assumed that the diskette was changed and AL returns
  5942.         0FFh. This error return is reportedly not completely reliable with DOS
  5943.         version 2.x.
  5944.      3) If found, the directory is updated to reflect the status in the FCB, the
  5945.         buffers to that file are flushed, and AL returns 00h.
  5946.  
  5947.  
  5948. Function  11h   Search For First Matching Entry                           (FCB)
  5949.       Searches current disk & directory for first matching filename
  5950. entry   AH      11h
  5951.         DS:DX   pointer to address of FCB
  5952. return  AL      00h     successful match
  5953.                 0FFh    no matching filename found
  5954. note 1) The FCB may contain the wildcard character ? under Dos 2.x, and ? or *
  5955.         under 3.x and 4.x.
  5956.      2) The original FCB at DS:DX contains information to continue the search
  5957.         with function 12h, and should not be modified.
  5958.      3) If a matching filename is found, AL returns 00h and the locations at the
  5959.         Disk Transfer Address are set as follows:
  5960.         a) If the FCB provided for searching was an extended FCB, then the first
  5961.            byte at the disk transfer address is set to 0FFh followed by 5 bytes
  5962.            of zeroes, then the attribute byte from the search FCB, then the
  5963.            drive number used (1=A, 2=B, etc) then the 32 bytes of the directory
  5964.            entry. Thus, the disk transfer address contains a valid unopened FCB
  5965.            with the same search attributes as the search FCB.
  5966.         b) If the FCB provided for searching was a standard FCB, then the first
  5967.            byte is set to the drive number used (1=A,2=b,etc), and the next 32
  5968.            bytes contain the matching directory entry. Thus, the disk transfer
  5969.            address contains a valid unopened normal FCB.
  5970.      4) If an extended FCB is used, the following search pattern is used:
  5971.         a) If the FCB attribute byte is zero, only normal file entries are
  5972.            found. Entries for volume label, subdirectories, hidden or system
  5973.            files, are not returned.
  5974.         b) If the attribute byte is set for hidden or system files, or
  5975.            subdirectory entries, it is to be considered as an inclusive search.
  5976.            All normal file entries plus all entries matching the specified
  5977.            attributes are returned. To look at all directory entries except the
  5978.            volume label, the attribute byte may be set to hidden + system +
  5979.            directory (all 3 bits on).
  5980.         c) If the attribute field is set for the volume label, it is considered
  5981.            an exclusive search, and ONLY the volume label entry is returned.
  5982.      5) This call is also used by the APPEND command in DOS 3.2+
  5983.  
  5984.  
  5985. Function  12h   Search For Next Entry Using FCB                          (FCB)
  5986.       Search for next matching filename
  5987. entry   AH      12h
  5988.         DS:DX   pointer to the unopened FCB specified from the previous Search
  5989.                 First (11h) or Search Next (12h)
  5990. return  AL      00h     if matching filename found
  5991.                 0FFh    if matching filename was not found
  5992. note 1) After a matching filename has been found using function call 11h,
  5993.         function 12h may be called to find the next match to an ambiguous
  5994.         request. For DOS 2.x, ?'s are allowed in the filename. For DOS 3.x
  5995.         and 4.x, global (*) filename characters are allowed.
  5996.      2) The DTA contains info from the previous Search First or Search Next.
  5997.      3) All of the FCB except for the name/extension field is used to keep
  5998.         information nescessary for continuing the search, so no disk operations
  5999.         may be performed with this FCB between a previous function 11h or 12h
  6000.         call and this one.
  6001.      4) If the file is found, an FCB is created at the DTA address and set up to
  6002.         open or delete it.
  6003.  
  6004.  
  6005. Function  13h   Delete File Via FCB                                       (FCB)
  6006.       Deletes file specified in FCB from current directory
  6007. entry   AH      13h
  6008.         DS:DX   pointer to address of FCB
  6009. return  AL      00h     file deleted
  6010.                 0FFh    if file not found or was read-only
  6011. note 1) All matching current directory entries are deleted. The global filename
  6012.         character "?" is allowed in the filename.
  6013.      2) Will not delete files with read-only attribute set
  6014.      3) Close open files before deleting them.
  6015.      4) Requires Network Access Rights
  6016.  
  6017.  
  6018. Function  14h   Sequential Disk File Read                                 (FCB)
  6019.       Reads record sequentially from disk via FCB
  6020. entry   AH  14h
  6021.         DS:DX   pointer to an opened FCB
  6022. return  AL      00h     successful read
  6023.                 01h     end of file (no data read)
  6024.                 02h     Data Transfer Area too small for record size specified
  6025.                         or segment overflow
  6026.                 03h     partial record read, EOF found
  6027. note 1) The record size is set to the value at offset 0Eh in the FCB.
  6028.      2) The record pointed to by the Current Block (offset 0Ch) and the Current
  6029.         Record (offset 20h) fields is loaded at the DTA, then the Current Block
  6030.         and Current Record fields are incremented.
  6031.      3) The record is read into memory at the current DTA address as specified
  6032.         by the most recent call to function 1Ah. If the size of the record and
  6033.         location of the DTA are such that a segment overflow or wraparound would
  6034.         occur, the error return is set to AL=02h
  6035.      4) If a partial record is read at the end of the file, it is passed to the
  6036.         requested size with zeroes and the error return is set to AL=03h.
  6037.  
  6038.  
  6039. Function  15h   Sequential Disk Write                                     (FCB)
  6040.       Writes record specified by FCB sequentially to disk
  6041. entry   AH      15h
  6042.         DS:DX   pointer to address of FCB
  6043. return  AL      00h     successful write
  6044.                 01h     diskette full, write canceled
  6045.                 02h     disk transfer area (DTA) too small or segment wrap
  6046. note 1) The data to write is obtained from the disk transfer area
  6047.      2) The record size is set to the value at offset 0Eh in the FCB.
  6048.      3) This service cannot write to files set as read-only
  6049.      4) The record pointed to by the Current Block (offset 0Ch) and the Current
  6050.         Record (offset 20h) fields is loaded at the DTA, then the Current Block
  6051.         and Current Record fields are incremented.
  6052.      5) If the record size is less than a sector, the data in the DTA is written
  6053.         to a buffer; the buffer is written to disk when it contains a full
  6054.         sector of data, the file is closed, or a Reset Disk (function 0Dh) is
  6055.         issued.
  6056.      6) The record is written to disk at the current DTA address as specified
  6057.         by the most recent call to function 1Ah. If the size of the record and
  6058.         location of the DTA are such that a segment overflow or wraparound would
  6059.         occur, the error return is set to AL=02h
  6060.  
  6061.  
  6062. Function  16h   Create A Disk File                                        (FCB)
  6063.       Search and open or create directory entry for file
  6064. entry   AH      16h
  6065.         DS:DX   pointer to an FCB
  6066. return  AL      00h     successful creation
  6067.                 0FFh    no room in directory
  6068. note 1) If a matching directory entry is found, the file is truncated to zero
  6069.         bytes.
  6070.      2) If there is no matching filename, a filename is created.
  6071.      3) This function calls function 0Fh (Open File) after creating or
  6072.         truncating a file.
  6073.      4) A hidden file can be created by using an extended FCB with the attribute
  6074.         byte (offset FCB-1) set to 2.
  6075.  
  6076.  
  6077. Function  17h   Rename File Specified by File Control Block              (FCB)
  6078.       Renames file in current directory
  6079. entry   AH      17h
  6080.         DS:DX   pointer to an FCB (see note 4)
  6081. return  AL      00h     successfully renamed
  6082.                 0FFh    file not found or filename already exists
  6083. note 1) This service cannot rename read-only files
  6084.      2) The "?" wildcard may be used.
  6085.      3) If the "?" wildcard is used in the second filename, the corresponding
  6086.         letters in the filename of the directory entry are not changed.
  6087.      4) The FCB must have a drive number, filename, and extension in the usual
  6088.         position, and a second filename starting 6 bytes after the first, at
  6089.         offset 11h.
  6090.      5) The two filenames cannot have the same name.
  6091.      6) FCB contains new name starting at byte 17h.
  6092.  
  6093.  
  6094. Function  18h  Internal to DOS
  6095.  *   Unknown
  6096. entry   AH      18h
  6097. return  AL      0
  6098.  
  6099.  
  6100. Function  19h   Get Current Disk Drive
  6101.       Return designation of current default disk drive
  6102. entry   AH      19h
  6103. return  AL      current default drive (0=A, 1=B,etc.)
  6104. note    Some other DOS functions use 0 for default, 1=A, 2=B, etc.
  6105.  
  6106.  
  6107. Function  1Ah   Set Disk Transfer Area Address (DTA)
  6108.       Sets DTA address to the address specified in DS:DX
  6109. entry   AH      1Ah
  6110.         DS:DX   pointer to buffer
  6111. return  none
  6112. note 1) The default DTA is 128 bytes at offset 80h in the PSP. DOS uses the
  6113.         DTA for all file I/O.
  6114.      2) Registers are unchanged.
  6115.      3) No error codes are returned.
  6116.      2) Disk transfers cannot wrap around from the end of the segment to the
  6117.         beginning or overflow into another segment.
  6118.  
  6119.  
  6120. Function  1Bh   Get Current Drive File Allocation Table Information
  6121.       Returns information from the FAT on the current drive
  6122. entry   AH      1Bh
  6123. exit    AL      number of sectors per allocation unit (cluster)
  6124.         DS:BX   address of the current drive's media descriptor byte
  6125.         CX      number of bytes per sector
  6126.         DX      number of allocation units (clusters) for default drive
  6127. note 1) Save DS before calling this function.
  6128.      2) This call returned a pointer to the FAT in DOS 1.x. Beginning with
  6129.         DOS 2.00, it returns a pointer only to the table's ID byte.
  6130.      3) IBM recommends programmers avoid this call and use int 25h instead.
  6131.  
  6132.  
  6133. Function  1Ch   Get File Allocation Table Information for Specific Device
  6134.       Returns information on specified drive
  6135. entry   AH      1Ch
  6136.         DL      drive number (1=A, 2=B, 3=C, etc)
  6137. return  AL      number of sectors per allocation unit (cluster)
  6138.         DS:BX   address of media descriptor byte for drive in DL
  6139.         CX      sector size in bytes
  6140.         DX      number of allocation units (clusters)
  6141. note 1) DL = 0 for default.
  6142.      2) Save DS before calling this function.
  6143.      3) Format of media-descriptor byte:
  6144.         bits:   0       0   (clear)   not double sided
  6145.                         1   (set)     double sided
  6146.                 1       0   (clear)   not 8 sector
  6147.                         1   (set)     8 sector
  6148.                 2       0   (clear)   nonremovable device
  6149.                         1   (set)     removable device
  6150.                 3-7     always set (1)
  6151.      4) This call returned a pointer to the FAT in DOS 1.x. Beginning with
  6152.         DOS 2.00, it returns a pointer only to the table's ID byte.
  6153.      5) IBM recommends programmers avoid this call and use int 25h instead.
  6154.  
  6155.  
  6156. Function  1Dh   Not Documented by Microsoft
  6157.  *    Unknown
  6158. entry   AH      1Dh
  6159. return  AL      0
  6160.  
  6161.  
  6162. Function  1Eh   Not Documented by Microsoft
  6163.  *    Unknown
  6164. entry   AH      1Eh
  6165. return  AL      0
  6166. note    Apparently does nothing
  6167.  
  6168.  
  6169. Function  1Fh Get Default Drive Parameter Block
  6170.  *  Same as function call 32h (below), except that the table is accessed from
  6171.     the default drive
  6172. entry   AH      1Fh
  6173.         other registers unknown
  6174. return  AL      00h     no error
  6175.                 0FFh    error
  6176.         DS:BX   points to DOS Disk Parameter Block for default drive.
  6177. note 1) Unknown vector returned in ES:BX.
  6178.      2) For DOS 2.x and 3.x, this just invokes function 32h (undocumented,
  6179.         Read DOS Disk Block) with DL=0
  6180.  
  6181.  
  6182. Function  20h  Unknown
  6183.  *   Internal - does nothing?
  6184. entry   AH      20h
  6185. return  AL      0
  6186.  
  6187.  
  6188. Function  21h  Random Read from File Specified by File Control Block     (FCB)
  6189.      Reads one record as specified in the FCB into the current DTA.
  6190. entry   AH      21h
  6191.         DS:DX   address of the opened FCB
  6192. return  AL      00h     successful read operation
  6193.                 01h     end of file (EOF), no data read
  6194.                 02h     DTA too small for the record size specified
  6195.                 03h     end of file (EOF), partial data read
  6196. note 1) The current block and current record fields are set to agree with the
  6197.         random record field. Then the record addressed by these fields is read
  6198.         into memory at the current Disk Transfer Address.
  6199.      2) The current file pointers are NOT incremented this function.
  6200.      3) If the DTA is larger than the file, the file is padded to the requested
  6201.         length with zeroes.
  6202.  
  6203.  
  6204. Function  22h  Random Write to File Specified by FCB                      (FCB)
  6205.      Writes one record as specified in the FCB to the current DTA
  6206. entry   AH      22h
  6207.         DS:DX   address of the opened FCB
  6208. return  AL      00h     successful write operation
  6209.                 01h     disk full; no data written (write was canceled)
  6210.                 02h     DTA too small for the record size specified (write was
  6211.                         canceled)
  6212. note 1) This service cannot write to read-only files.
  6213.      2) The record pointed to by the Current Block (offset 0Ch) and the Current
  6214.         Record (offset 20h) fields is loaded at the DTA, then the Current Block
  6215.         and Current Record fields are incremented.
  6216.      3) If the record size is less than a sector, the data in the DTA is written
  6217.         to a buffer; the buffer is written to disk when it contains a full
  6218.         sector of data, the file is closed, or a Reset Disk (function 0Dh) is
  6219.         issued.
  6220.      4) The current file pointers are NOT incremented this function.
  6221.      5) The record is written to disk at the current DTA address as specified
  6222.         by the most recent call to function 1Ah. If the size of the record and
  6223.         location of the DTA are such that a segment overflow or wraparound would
  6224.         occur, the error return is set to AL=02h
  6225.  
  6226.  
  6227. Function  23h  Get File Size                                             (FCB)
  6228.      Searches current subdirectory for matching file, returns size in FCB
  6229. entry   AH      23h
  6230.         DS:DX   address of an unopened FCB
  6231. return  AL      00h file found
  6232.                 0FFh file not found
  6233. note 1) Record size field (offset 0Eh) must be set before invoking this function
  6234.      2) The disk directory is searched for the matching entry. If a matching
  6235.         entry is found, the random record field is set to the number of records
  6236.         in the file. If the value of the Record Size field is not an even
  6237.         divisor of the file size, the value set in the relative record field is
  6238.         rounded up. This gives a returned value larger than the actual file size
  6239.      3) This call is used by the APPEND command in DOS 3.2+
  6240.  
  6241.  
  6242. Function  24h  Set Relative Record Field                                  (FCB)
  6243.      Set random record field specified by an FCB
  6244. entry   AH      24h
  6245.         DS:DX   address of an opened FCB
  6246. return  Random Record Field of FCB is set to be same as Current Block
  6247.         and Current Record.
  6248. note 1) You must invoke this function before performing random file access.
  6249.      2) The relative record field of FCB (offset 21h) is set to be same as the
  6250.         Current Block (offset 0Ch) and Current Record (offset 20h).
  6251.      3) No error codes are returned.
  6252.      4) The FCB must already be opened.
  6253.  
  6254.  
  6255. Function  25h  Set Interrupt Vector
  6256.      Sets the address of the code DOS is to perform each time the specified
  6257.      interrupt is invoked.
  6258. entry   AH      25h
  6259.         AL      int number to reassign the handler to
  6260.         DS:DX   address of new interrupt vector
  6261. return  none
  6262. note 1) Registers are unchanged.
  6263.      2) No error codes are returned.
  6264.      3) The interrupt vector table for the interrupt number specified in AL
  6265.         is set to the address contained in DS:DX. Use function 35h (Get Vector)
  6266.         to get the contents of the interrupt vector and save it for later use.
  6267.      4) When you use function 25 to set an interrupt vector, DOS 3.2 doesn't
  6268.         point the actual interrupt vector to what you requested. Instead, it
  6269.         sets the interrupt vector to point to a routine inside DOS, which does
  6270.         this:
  6271.                 1. Save old stack pointer
  6272.                 2. Switch to new stack pointer allocated from DOS's stack pool
  6273.                 3. Call your routine
  6274.                 4. Restore old stack pointer
  6275.         The purpose for this was to avoid possible stack overflows when there
  6276.         are a large number of active interrupts. IBM was concerned (this was an
  6277.         IBM change, not Microsoft) that on a Token Ring network there would be
  6278.         a lot of interrupts going on, and applications that hadn't allocated
  6279.         very much stack space would get clobbered.
  6280.  
  6281.  
  6282. Function  26h  Create New Program Segment Prefix (PSP)
  6283.      This service copies the current program-segment prefix to a new memory
  6284.      location for the creation of a new program or overlay. Once the new PSP is
  6285.      in place, a DOS program can read a DOS COM or overlay file into the memory
  6286.      location immediately following the new PSP and pass control to it.
  6287. entry   AH      26h
  6288.         DX      segment number for the new PSP
  6289. return  none
  6290. note 1) Microsoft recommends you use the newer DOS service 4Bh (EXEC) instead.
  6291.      2) The entire 100h area at location 0 in the current PSP is copied into
  6292.         location 0 of the new PSP. The memory size information at location 6
  6293.         in the new segment is updated and the current termination, ctrl-break,
  6294.         and critical error addresses from interrupt vector table entries for
  6295.         ints 22h, 23h, and 24 are saved in the new program segment starting at
  6296.         0Ah. They are restored from this area when the program terminates.
  6297.      3) Current PSP is copied to specified segment
  6298.  
  6299.  
  6300. Function  27h  Random Block Read From File Specified by FCB
  6301.      Similar to 21h (Random Read) except allows multiple files to be read.
  6302. entry   AH      27h
  6303.         CX      number of records to be read
  6304.         DS:DX   address of an opened FCB
  6305. return  AL      00h     successful read
  6306.                 01h     end of file, no data read
  6307.                 02h     DTA too small for record size specified (read canceled)
  6308.                 03h     end of file
  6309.         CX      actual number of records read (includes partial if AL=03h)
  6310. note 1) The record size is specified in the FCB. The service updates the Current
  6311.         Block (offset 0Ch) and Current Record (offset 20h) fields to the next
  6312.         record not read.
  6313.      2) If CX contained 0 on entry, this is a NOP.
  6314.      3) If the DTA is larger than the file, the file is padded to the requested
  6315.         length with zeroes.
  6316.      4) This function assumes that the FCB record size field (0Eh) is correctly
  6317.         set. If not set by the user, the default is 128 bytes.
  6318.      5) The record is written to disk at the current DTA address as specified
  6319.         by the most recent call to function 1Ah. If the size of the record and
  6320.         location of the DTA are such that a segment overflow or wraparound would
  6321.         occur, the error return is set to AL=02h
  6322.  
  6323.  
  6324. Function  28h  Random Block Write to File Specified in FCB
  6325.      Similar to 27h (Random Write) except allows multiple files to be read.
  6326. entry   AH      28h
  6327.         CX      number of records to write
  6328.         DS:DX   address of an opened FCB
  6329. return  AL      00h     successful write
  6330.                 01h     disk full, no data written
  6331.                 02h     DTA too small for record size specified (write canceled)
  6332.         CX      number of records written
  6333. note 1) The record size is specified in the FCB.
  6334.      2) This service allocates disk clusters as required.
  6335.      3) This function assumes that the FCB Record Size field (offset 0Eh) is
  6336.         correctly set. If not set by the user, the default is 128 bytes.
  6337.      4) The record size is specified in the FCB. The service updates the Current
  6338.         Block (offset 0Ch) and Current Record (offset 20h) fields to the next
  6339.         record not read.
  6340.      5) The record is written to disk at the current DTA address as specified
  6341.         by the most recent call to function 1Ah. If the size of the record and
  6342.         location of the DTA are such that a segment overflow or wraparound would
  6343.         occur, the error return is set to AL=02h
  6344.      6) If called with CX=0, no records are written, but the FCB's File Size
  6345.         entry (offset 1Ch) is set to the size specified by the FCB's Relative
  6346.         Record field (offset 21h).
  6347.  
  6348.  
  6349. Function  29h  Parse the Command Line for Filename
  6350.      Parses a text string into the fields of a File Control Block
  6351. entry   AH      29h
  6352.         DS:SI   pointer to string to parse
  6353.         ES:DI   pointer to memory buffer to fill with unopened FCB
  6354.         AL      bit mask to control parsing
  6355.                 bit 0 = 0: parsing stops if file seperator found
  6356.                         1: causes service to scan past leading chars such as
  6357.                            blanks. Otherwise assumes the filename begins in
  6358.                            the first byte
  6359.                     1 = 0: drive number in FCB set to default (0) if string
  6360.                            contains no drive number
  6361.                         1: drive number in FCB not changed
  6362.                     2 = 0: filename in FCB set to 8 blanks if no filename in
  6363.                            string
  6364.                         1: filename in FCB not changed if string does not
  6365.                            contain a filename
  6366.                     3 = 0: extension in FCB set to 3 blanks if no extension in
  6367.                            string
  6368.                         1: extension left unchanged
  6369.                     4-7    must be zero
  6370. return  AL      00h     no wildcards in name or extension
  6371.                 01h     wildcards appeared in name or extension
  6372.                 0FFh    invalid drive specifier
  6373.         DS:SI   pointer to the first byte after the parsed string
  6374.         ES:DI   pointer to a buffer filled with the unopened FCB
  6375. note 1) If the * wildcard characters are found in the command line, this service
  6376.         will replace all subsequent chars in the FCB with question marks.
  6377.      2) This service uses the characters as filename separators
  6378.         DOS 1       : ; . , + / [ ] = " TAB SPACE
  6379.         DOS 2,3     : ; . , + = TAB SPACE
  6380.      3) This service uses the characters
  6381.         : ; . , + < > | / \ [ ] = " TAB SPACE
  6382.         or any control characters as valid filename separators
  6383.      4) A filename cannot contain a filename terminator. If one is encountered,
  6384.         all processing stops. The handle functions will allow use of some of
  6385.         these characters.
  6386.      5) If no valid filename was found on the command line, ES:DI +1 points
  6387.         to a blank (ASCII 32).
  6388.      6) This function cannot be used with filespecs which include a path
  6389.      7) Parsing is in the form D:FILENAME.EXT. If one is found, a corresponding
  6390.         unopened FCB is built at ES:DI
  6391.  
  6392.  
  6393. Function  2Ah  Get Date
  6394.      Returns day of the week, year, month, and date
  6395. entry   AH      2Ah
  6396. return  CX      year    (1980-2099)
  6397.         DH      month   (1-12)
  6398.         DL      day     (1-31)
  6399.         AL      weekday 00h     Sunday
  6400.                         01h     Monday
  6401.                         02h     Tuesday
  6402.                         03h     Wednesday
  6403.                         04h     Thursday
  6404.                         05h     Friday
  6405.                         06h     Saturday
  6406. note 1) Date is adjusted automatically if clock rolls over to the next day,
  6407.         and takes leap years and number of days in each month into account.
  6408.      2) Although DOS cannot set an invalid date, it can read one, such as
  6409.         1/32/80, etc.
  6410.      3) DesQview also accepts CX = 4445h and DX = 5351h, i.e. 'DESQ' as valid
  6411.      4) DOS will accept CH=0 (midnight) as a valid time, but if a file's time
  6412.         is set to exactly midnight the time will not be displayed by the DIR
  6413.         command.
  6414.  
  6415.  
  6416. Function  2Bh  Set Date
  6417.      set current system date
  6418. entry   AH      2Bh
  6419.         CX      year    (1980-2099)
  6420.         DH      month   (1-12)
  6421.         DL      day     (1-31)
  6422. return  AL      00h     no error (valid date)
  6423.                 0FFh    invalid date specified
  6424. note 1) On entry, CX:DX must have a valid date in the same format as returned
  6425.         by function call 2Ah
  6426.      2) DOS 3.3 also sets CMOS clock
  6427.  
  6428.  
  6429. Function  2Ch  Get Time
  6430.      Get current system time from CLOCK$ driver
  6431. entry   AH      2Ch
  6432. return  CH      hours   (0-23)
  6433.         CL      minutes (0-59)
  6434.         DH      seconds (0-59)
  6435.         DL      hundredths of a second (0-99)
  6436. note 1) Time is updated every 5/100 second.
  6437.      2) The date and time are in binary format
  6438.  
  6439.  
  6440. Function  2Dh  Set Time
  6441.      Sets current system time
  6442. entry   AH      2Dh
  6443.         CH      hours   (0-23)
  6444.         CL      minutes (0-59)
  6445.         DH      seconds (0-59)
  6446.         DL      hundredths of seconds (0-99)
  6447. return  AL      00h     if no error
  6448.                 0FFh    if bad value sent to routine
  6449. note 1) DOS 3.3 also sets CMOS clock
  6450.      2) CX and DX must contain a valid time in binary
  6451.  
  6452.  
  6453. Function  2Eh  Set/Reset Verify Switch
  6454.      Set verify flag
  6455. entry   AH      2Eh
  6456.         AL      00      to turn verify off (default)
  6457.                 01      to turn verify on
  6458. return  none
  6459. note 1) This is the call invoked by the DOS VERIFY command
  6460.      2) Setting of the verify switch can be obtained by calling call 54h
  6461.      3) This call is not supported on network drives
  6462.      4) DOS checks this flag each time it accesses a disk
  6463.  
  6464.  
  6465. Function  2Fh  Get Disk Transfer Address (DTA)
  6466.      Returns current disk transfer address used by all DOS read/write operations
  6467. entry   AH      2Fh
  6468. return  ES:BX   address of DTA
  6469. note 1) The DTA is set by function call 1Ah
  6470.      2) Default DTA address is a 128 byte buffer at offset 80h in that program's
  6471.         Program Segment Prefix
  6472.  
  6473.  
  6474. Function  30h  Get DOS Version Number
  6475.      Return DOS version and/or user number
  6476. entry   AH      30h
  6477. return  AH      minor version number  (i.e., DOS 2.10 returns AX = 0A02h)
  6478.         AL      major version number
  6479.         BH      OEM ID number
  6480.                 00h     IBM
  6481.                 16h     DEC    (others not known)
  6482.         BL:CX   24-bit user serial number
  6483. note 1) If AL returns a major version number of zero, the DOS version is
  6484.         below 1.28 for MSDOS and below 2.00 for PCDOS.
  6485.      2) IBM PC-DOS always returns 0000h in BX and CX.
  6486.      3) OS/2 v1.0 Compatibility Box returns a value of 10 for major version.
  6487.      4) Due to the OS/2 return and the fact that some European versions of DOS
  6488.         carry higher version numbers than IBM's DOS, utilities which check
  6489.         for a DOS version should not abort if a higher version than required
  6490.         is found unless some specific problems are known.
  6491.  
  6492.  
  6493. Function  31h  Terminate Process and Stay Resident
  6494.      KEEP, or TSR
  6495. entry   AH      31h
  6496.  
  6497.         AL      exit code
  6498.         DX      program memory requirement in 16 byte paragraphs
  6499. return  AX      return code (retrieveable by function 4Dh)
  6500. note 1) Files opened by the application are not closed when this call is made
  6501.      2) Memory can be used more efficiently if the block containing the copy of
  6502.         the DOS environment is deallocated before terminating. This can be done
  6503.         by loading ES with the segment contained in 2Ch of the PSP and issuing
  6504.         function call 49h (Free Allocated Memory).
  6505.      3) Unlike int 27h, more than 64k may be made resident with this call
  6506.  
  6507.  
  6508. Function  32h  Read DOS Disk Block
  6509.  *   Retrieve the pointer to the drive parameter block for a drive
  6510. entry   AH      32h
  6511.         DL      drive (0=default, 1=A:, etc.).
  6512. return  AL      00h     if drive is valid
  6513.                 0FFh    if drive is not valid
  6514.         DS:BX   pointer to DOS Drive Parameter Table. Format of block:
  6515.                 Bytes   Type        Value
  6516.                 00h     byte    Drive: 0=A:, 1=B:, etc.
  6517.                 01h     byte    Unit within drive (0, 1, 2, etc.)
  6518.                 02h-03h word    Bytes per sector
  6519.                 04h     byte    Sectors per cluster - 1
  6520.                 05h     byte    Cluster to sector shift (i.e., how far to shift-
  6521.                                 left the bytes/sector to get bytes/cluster)
  6522.                 06h-07h word    Number of reserved (boot) sectors
  6523.                 08h     byte    Number of FATs
  6524.                 09h-0Ah word    Number of root directory entries
  6525.                 0Bh-0Ch word    Sector # of 1st data. Should be same as # of
  6526.                                 sectors/track.
  6527.                 0Dh-0Eh word    # of clusters + 1 (=last cluster #)
  6528.                 0Fh     byte    Sectors for FAT
  6529.                 10h-11h word    First sector of root directory
  6530.                 12h-15h dword   Address of device driver header for this drive
  6531.                 16h     byte    Media Descriptor Byte for this drive
  6532.                 17h     byte    0FFh indicates block must be rebuilt
  6533.                                 (DOS 3.x) 00h indicates block device has
  6534.                                 been accessed
  6535.                 18h-1Bh dword   address of next DOS Disk Block (0FFFFh means
  6536.                                 last in chain)
  6537.                 22h     byte    Current Working Directory (2.0 only) (64 bytes)
  6538. note 1) Use [BX+0D] to find no. of clusters (>1000H, 16-bit FAT; if not, 12-bit
  6539.         (exact dividing line is probably a little below 1000h to allow for
  6540.         bad sectors, EOF markers, etc.)
  6541.      2) Short article by C.Petzold, PC Magazine  Vol.5,no.8, and the article
  6542.         "Finding Disk Parameters" in the May 1986 issue of PC Tech Journal.
  6543.      3) This call is mostly supported in OS/2 1.0's DOS Compatibility Box. The
  6544.         dword at 12h will not return the address of the next device driver when
  6545.         in the Compatibility Box.
  6546.      4) used by CHKDSK
  6547.  
  6548.  
  6549. Function  33h  Control-Break Check
  6550.      Get or set control-break checking at CON
  6551. entry   AH      33h
  6552.         AL      00h     to test for break checking
  6553.                 01h     to set break checking
  6554.                         DL      00h     to disable break checking
  6555.                                 01h     to enable break checking
  6556.                 02h     internal, called by PRINT.COM (DOS 3.1)
  6557.                 03h     unknown
  6558.                 04h     unknown
  6559.                 05h     boot drive (DOS 4.0+)
  6560. return  DL      00h     if break=off
  6561.                 01h     if break=on
  6562.                 (if AL=05h) boot drive, A=1, B=2, etc)
  6563.         AL      0FFh    error
  6564.  
  6565.  
  6566. Function  34h  Return INDOS Flag
  6567.  *   Returns ES:BX pointing to Critical Section Flag, byte indicating whether
  6568.      it is safe to interrupt DOS.
  6569. entry   AH      34h
  6570. return  ES:BX   points to DOS "critical section flag"
  6571. note 1) If byte is 0, it is safe to interrupt DOS. This was mentioned in some
  6572.         documentation by Microsoft on a TSR standard, and PC Magazine reports
  6573.         it functions reliably under DOS versions 2.0 through 3.3. Chris
  6574.         Dunford (of CED fame) and a number of anonymous messages on the BBSs
  6575.         indicate it may not be totally reliable.
  6576.      2) The byte at ES:BX+1 is used by the Print program for this same purpose,
  6577.         so it's probably safer to check the WORD at ES:BX.
  6578.      3) Reportedly, examination of DOS 2.10 code in this area indicates that the
  6579.         byte immediately following this "critical section flag" must be 00h to
  6580.         permit the PRINT.COM interrupt to be called. For DOS 3.0 and 3.1 (except
  6581.         Compaq DOS 3.0), the byte before the "critical section flag" must be
  6582.         zero; for Compaq DOS 3.0, the byte 01AAh before it must be zero.
  6583.      4) In DOS 3.10 this reportedly changed to word value, with preceding byte.
  6584.      5) This call is supported in OS/2 1.0's DOS Compatibility Box
  6585.      6) Gordon Letwin of Microsoft discussed this call on usenet in 1984. He
  6586.         stated:
  6587.         a) this is not supported under any version of the DOS
  6588.         b) it usually works under DOS 2, but there may be circumstances
  6589.            when it doesn't (general disclaimer, don't know of a specific
  6590.            circumstance)
  6591.         c) it will usually not work under DOS 3 and DOS 3.1; the DOS is
  6592.            considerably restructured and this flag takes on additional
  6593.            meanings and uses
  6594.         d) it will fail catastrophically under DOS 4.0 and forward.
  6595.            Obviously this information is incorrect since the call works fine
  6596.            through DOS 3.3. Microsoft glasnost?
  6597.  
  6598.  
  6599. Function  35h  Get Vector
  6600.      Get interrupt vector
  6601. entry   AH      35h
  6602.         AL      interrupt number (hexadecimal)
  6603. return  ES:BX   address of interrupt vector
  6604. note    Use function call 25h to set the interrupt vectors
  6605.  
  6606.  
  6607. Function  36h  Get Disk Free Space
  6608.      get information on specified drive
  6609. entry   AH      36h
  6610.         DL      drive number (0=default, 1=A:, 2=B:, etc)
  6611. return  AX      number of sectors per cluster
  6612.                 0FFFFh means drive specified in DL is invalid
  6613.         BX      number of availible clusters
  6614.         CX      bytes per sector
  6615.         DX      clusters per drive
  6616. note 1) Mult AX * CX * BX for free space on disk
  6617.      2) Mult AX * CX * DX for total disk space
  6618.      3) Function 36h returns an incorrect value after an ASSIGN command. Prior
  6619.         to ASSIGN, the DX register contains 0943h on return, which is the free
  6620.         space in clusters on the HC diskette. After ASSIGN, even with no
  6621.         parameters, 0901h is returned in the DX register; this is an incorrect
  6622.         value. Similar results occur with DD diskettes on a PC-XT or a PC-AT.
  6623.         This occurs only when the disk is not the default drive. Results are as
  6624.         expected when the drive is the default drive. Therefore, the
  6625.         circumvention is to make the desired drive the default drive prior to
  6626.         issuing this function call.
  6627.      4) Int 21h, function call 36h returns an incorrect value after an ASSIGN
  6628.         command. Prior to ASSIGN, the DX register contains 0943h on return,
  6629.         which is the free space in clusters on the HC diskette. After ASSIGN,
  6630.         even with no parameters, 0901h is returned in the DX register; this is
  6631.         an incorrect value. Similar results occur with DD diskettes on a PC-XT
  6632.         or a PC-AT. This occurs only when the disk is not the default drive.
  6633.         Results are as expected when the drive is the default drive. Therefore,
  6634.         the circumvention is to make the desired drive the default drive prior
  6635.         to issuing this function call.
  6636.      5) This function supercedes functions 1Bh and 1Ch.
  6637.  
  6638.  
  6639. Function  37h  SWITCHAR / AVAILDEV
  6640.  *   Get/set option marking character (is usually "/"), and device type
  6641. entry   AH      37h
  6642.         AL      00h     read switch character (returns current character in DL)
  6643.                 01h     set character in DL as new switch character
  6644.       (DOS 2.x) 02h     read device availability (as set by function AL=3) into
  6645.                         DL. A 0 means devices that devices must be accessed in
  6646.                         file I/O calls by /dev/device. A non-zero value means
  6647.                         that devices are accessible at every level of the
  6648.                         directory tree (e.g., PRN is the printer and not a file
  6649.                         PRN).
  6650.                         AL=2 to return flag in DL, AL=3 to set from DL (0 = set,
  6651.                         1 = not set).
  6652.       (DOS 2.x) 03h     get device availability, where:
  6653.         DL      00h     means /dev/ must precede device names
  6654.                 01h     means /dev/ need not precede device names
  6655. return  DL      switch character (if AL=0 or 1)
  6656.                 device availability flag (if AL=2 or 3)
  6657.         AL      0FFh    the value in AL was not in the range 0-3.
  6658. note 1) Functions 2 & 3 appear not to be implemented for DOS 3.x.
  6659.      2) It is documented on page 4.324 of the MS-DOS (version 2) Programmer's
  6660.         Utility Pack (Microsoft - published by Zenith).
  6661.      3) Works on all versions of IBM PC-DOS from 2.0 through 3.3.1.
  6662.      4) The SWITCHAR is the character used for "switches" in DOS command
  6663.         arguments (defaults to '/', as in "DIR/P"). '-' is popular to make a
  6664.         system look more like UNIX; if the SWITCHAR is anything other than '/',
  6665.         then '/' may be used instead of '\' for pathnames
  6666.      5) Ignored by XCOPY, PKARC, LIST
  6667.      6) SWITCHAR may not be set to any character used in a filename
  6668.      7) In DOS 3.x you can still read the "AVAILDEV" byte with subfunction 02h
  6669.         but it always returns 0FFh even if you try to change it to 0 with
  6670.         subfunction 03h.
  6671.      8) AVAILDEV=0 means that devices must be referenced in an imaginary
  6672.         subdirectory "\dev" (similar to UNIX's /dev/*); a filename "PRN.DAT"
  6673.         can be created on disk and manipulated like any other. If AVAILDEV != 0
  6674.         then device names are recognized anywhere (this is the default):
  6675.         "PRN.DAT" is synonymous with "PRN:".
  6676.      9) These functions reportedly are not supported in the same fashion in
  6677.         various implementations of DOS.
  6678.     10) used by DOS 3.3 CHKDSK, BASIC, DEBUG
  6679.  
  6680.  
  6681. Function  38h   Return Country Dependent Information
  6682.                 (PCDOS 2.0, 2.1, MSDOS 2.00 only)
  6683. entry   AH      38h
  6684.         AL      function code  (must be 0 in DOS 2.x)
  6685.         DS:DX   pointer to 32 byte memory buffer for returned information
  6686. return  CF      set on error
  6687.                 AX      error code (02h)
  6688.         BX      country code
  6689.         DS:DX   pointer to buffer filled with country information:
  6690.                 bytes 0,1       date/time format
  6691.                                 0       USA standard       H:M:S   M/D/Y
  6692.                                 1       European standard  H:M:S   D/M/Y
  6693.                                 2       Japanese standard  H:M:S   D:M:Y
  6694.                 byte2   ASCIIZ string currency symbol
  6695.                 byte3   zeroes
  6696.                 byte4   ASCIIZ string thousands separator
  6697.                 byte5   zeroes
  6698.                 byte6   ASCIIZ string decimal separator
  6699.                 byte7   zeroes
  6700.                 bytes 8,1Fh  24 bytes   reserved
  6701.  
  6702.  
  6703. Function  38h   Get Country Dependent Information
  6704.                 (PCDOS 3.x+, MSDOS 2.01+)
  6705. entry   AH      38h
  6706.         AL      function code
  6707.                 00h     to get current country information
  6708.                 01h-0FEh country code to get information for, for countries
  6709.                         with codes less than 255
  6710.                 0FFh    to get country information for countries with a code
  6711.                         greater than 255
  6712.                         BX      16 bit country code if AL=0FFh
  6713.         DS:DX   pointer to the memory buffer where the data will be returned
  6714.                 DX      0FFFFh if setting country code rather than getting info
  6715. return  CF      0 (clear) function completed
  6716.                 1 (set) error
  6717.                    AX   error code
  6718.                         02h     invalid country code (no table for it)
  6719.         (if DX <> 0FFFFh)
  6720.         BX      country code (usually international telephone code)
  6721.         DS:DX   pointer to country data buffer
  6722.           bytes 0,1     date/time format
  6723.                         0       USA standard       H:M:S   M/D/Y
  6724.                         1       European standard  H:M:S   D/M/Y
  6725.                         2       Japanese standard  H:M:S   D:M:Y
  6726.           bytes 2-6     currency symbol null terminated
  6727.           byte  07h     thousands separator null terminated
  6728.           byte  08h     zeroes
  6729.           byte  09h     decimal separator null terminated
  6730.           byte  0Ah     zeroes
  6731.           byte  0Bh     date separator null terminated
  6732.           byte  0Ch     zeroes
  6733.           byte  0Dh     time separator null terminated
  6734.           byte  0Eh     zeroes
  6735.           byte  0Fh     bit field currency format
  6736.                         bit 0 = 0  if currency symbol precedes the value
  6737.                                 1  if currency symbol is after the value
  6738.                         bit 1 = 0  no spaces between value and currency symbol
  6739.                                 1  one space between value and currency symbol
  6740.                         bit 2 = 1  set if currency symbol replaces decimal pt
  6741.                         bits 3-7   not defined by Microsoft
  6742.           byte  10h     number of significant decimal digits in currency
  6743.                         (number of places to right of decimal point)
  6744.           byte  11h     time format
  6745.                         bit 0 = 0       12 hour clock
  6746.                                 1       24 hour clock
  6747.                         bits 1-7 unknown, probably not used
  6748.           bytes 12h-15h address of case map routine (FAR CALL, AL = char)
  6749.                         entry   AL  ASCII code of character to be converted to
  6750.                                     uppercase
  6751.                         return  AL  ASCII code of the uppercase input character
  6752.           byte  16h     data-list separator character
  6753.           byte  17h     zeroes
  6754.           bytes 18h-21h 5 words reserved
  6755. note 1) When an alternate keyboard handler is invoked, the keyboard routine is
  6756.         loaded into user memory starting at the lowest portion of availible
  6757.         user memory. The BIOS interrupt vector that services the keyboard is
  6758.         redirected to the memory area where the new routine resides. Each new
  6759.         routine takes up about 1.6K of memory and has lookup tables that return
  6760.         values unique to each language. (KEYBxx in the DOS book)
  6761.          Once the keyboard interrupt vector is changed by the DOS keyboard
  6762.         routine, the new routine services all calls unless the system is
  6763.         returned to the US format by the ctrl-alt-F1 keystroke combination. This
  6764.         does not change the interrupt vector back to the BIOS location; it
  6765.         merely passes the table lookup to the ROM locations.
  6766.      2) Ctrl-Alt-F1 will only change systems with US ROMS to the US layout.
  6767.         Some systems are delivered with non-US keyboard handler routines in ROM
  6768.      3) Case mapping call: the segment/offset of a FAR procedure that performs
  6769.         country-specific lower-to-upper case mapping on ASCII characters 80h to
  6770.         0FFh. It is called with the character to be mapped in AL. If there is
  6771.         an uppercase code for the letter, it is returned in AL, if there is no
  6772.         code or the function was called with a value of less than 80h AL is
  6773.         returned unchanged.
  6774.      4) This call is fully implemented in MS-DOS version 2.01 and higher. It
  6775.         is in version 2.00 but not fully implemented (according to Microsoft)
  6776.  
  6777.  
  6778. Function  38h   Set Country Dependent Information
  6779. entry   AH      38h
  6780.         AL      code    country code to set information for, for countries
  6781.                         with codes less than 255
  6782.                 0FFh    to set country information for countries with a code
  6783.                         greater than 255
  6784.         BX      16 bit country code if AL=0FFh
  6785.         DX      0FFFFh
  6786. return  CF      clear   successful
  6787.                 set     if error
  6788.                         AX      error code (02h)
  6789.  
  6790.  
  6791. Function  39h   Create Subdirectory (MKDIR)
  6792.                 Makes a subdirectory along the indicated path
  6793. entry   AH      39h
  6794.         DS:DX   address of ASCIIZ pathname string
  6795. return  flag CF 0       successful
  6796.                 1       error
  6797.                         AX      error code if any  (3, 5)
  6798. note 1) The ASCIIZ string may contain drive and subdirectory.
  6799.      2) Drive may be any valid drive (not nescessarily current drive)
  6800.      3) The pathname cannot exceed 64 characters
  6801.  
  6802.  
  6803. Function  3Ah   Remove Subdirectory  (RMDIR)
  6804. entry   AH      3Ah
  6805.         DS:DX   address of ASCIIZ pathname string
  6806. return  CF      clear     successful
  6807.                 set       AX      error code if any  (3, 5, 16)
  6808. note 1) The ASCIIZ string may contain drive and subdirectory.
  6809.      2) Drive may be any valid drive (not nescessarily current drive)
  6810.      3) The pathname cannot exceed 64 characters
  6811.  
  6812.  
  6813. Function  3Bh   Change Current Directory  (CHDIR)
  6814. entry   AH      3Bh
  6815.         DS:DX   address of ASCIIZ string
  6816. return  flag CF 0       successful
  6817.                 1       error
  6818.         AX      error code if any (3)
  6819. note 1) The pathname cannot exceed 64 characters
  6820.      2) The ASCIIZ string may contain drive and subdirectory.
  6821.      3) Drive may be any valid drive (not nescessarily current drive)
  6822.  
  6823.  
  6824. Function  3Ch   Create A File (CREAT)
  6825.                 Create a file with handle
  6826. entry   AH      3Ch
  6827.         CX      attributes for file
  6828.                 00h     normal
  6829.                 01h     read only
  6830.                 02h     hidden
  6831.                 03h     system
  6832.         DS:DX   address of ASCIIZ filename string
  6833. return  flag CF 0       successful creation
  6834.                 1       error
  6835.         AX      16 bit file handle
  6836.                 or error code  (3, 4, 5)
  6837. note 1) The ASCIIZ string may contain drive and subdirectory.
  6838.      2) Drive may be any valid drive (not nescessarily current drive)
  6839.      3) If the volume label or subdirectory bits are set in CX, they are ignored
  6840.      4) The file is opened in read/write mode
  6841.      5) If the file does not exist, it is created. If one of the same name
  6842.         exists, it is truncated to a length of 0.
  6843.      6) Good practice is to attempt to open a file with fn 3Dh and jump to an
  6844.         error routine if successful, create file if 3Dh fails. That way an
  6845.         existing file will not be truncated and overwritten.
  6846.  
  6847.  
  6848. Function  3Dh   Open A File
  6849.                 Open disk file with handle
  6850. entry   AH      3Dh
  6851.         AL      access code byte
  6852. (DOS 2.x)       bits 0-2  file attribute
  6853.                 000     read only
  6854.                 001     write only
  6855.                 010     read/write
  6856.                 bits 3-7 should be set to zero
  6857. (DOS 3.x)       bits 0-2  file attribute
  6858.                 000     read only
  6859.                 001     write only
  6860.                 010     read/write
  6861.                 bit 3   reserved
  6862.                 0       should be set to zero
  6863.                 bits 4-6 sharing mode (network)
  6864.                 000     compatibility mode (the way FCBs open files)
  6865.                 001     read/write access denied (exclusive)
  6866.                 010     write access denied
  6867.                 011     read access denied
  6868.                 100     full access permitted
  6869.                 bit 7   inheritance flag
  6870.                 0       file inherited by child process
  6871.                 1       file private to child process
  6872.         DS:DX   address of ASCIIZ pathname string
  6873. return  flag CF set on error
  6874.                 AX      error code
  6875.                 1       error
  6876.         AX      16 bit file handle
  6877.                 or error code (1, 2, 4, 5, 0Ch)
  6878. note 1) Opens any normal, system, or hidden file
  6879.      2) Files that end in a colon are not opened
  6880.      3) The rear/write pointer is set at the first byte of the file and the
  6881.         record size of the file is 1 byte (the read/write pointer can be changed
  6882.         through function call 42h). The returned file handle must be used for
  6883.         all subsequent input and output to the file.
  6884.      4) If the file handle was inherited from a parent process or was
  6885.         duplicated by DUP or FORCEDUP, all sharing and access restrictions are
  6886.         also inherited.
  6887.      5) A file sharing error (error 1) causes an int 24h to execute with an
  6888.         error code of 2
  6889.  
  6890.  
  6891. Function  3Eh   Close A File Handle
  6892.                 Close a file and release handle for reuse
  6893. entry   AH      3Eh
  6894.         BX      file handle
  6895. return  flag CF 0       successful close
  6896.                 1       error
  6897.         AX      error code if error (6)
  6898. note 1) When executed, the file is closed, the directory is updated, and all
  6899.         buffers for that file are flushed. If the file was changed, the time
  6900.         and date stamps are changed to current
  6901.      2) If called with the handle 00000, it will close STDIN (normally the
  6902.         keyboard).
  6903.  
  6904.  
  6905. Function  3Fh   Read From A File Or Device
  6906.                 Read from file with handle
  6907. entry   AH      3Fh
  6908.         BX      file handle
  6909.         CX      number of bytes to read
  6910.         DS:DX   address of buffer
  6911. return  flag CF 0       successful read
  6912.                 1       error
  6913.         AX      0       pointer was already at end of file
  6914.                         or number of bytes read
  6915.                         or error code (5, 6)
  6916. note 1) This function attempts to transfer the number of bytes specified in CX
  6917.         to a buffer location. It is not guaranteed that all bytes will be read.
  6918.         If AX < CX a partial record was read.
  6919.      2) If performed from STDIN (file handle 0000), the input can be redirected
  6920.      3) If used to read the keyboard, it will only read to the first CR
  6921.      4) The file pointer is incremented to the last byte read.
  6922.  
  6923.  
  6924. Function  40h   Write To A File Or Device
  6925.                 Write to file with handle
  6926. entry   AH      40h
  6927.         BX      file handle
  6928.         CX      number of bytes to write
  6929.         DS:DX   address of buffer
  6930. return  flag CF 0       successful write
  6931.                 1       error
  6932.         AX      number of bytes written
  6933.                 or error code  (5, 6)
  6934. note 1) This call attempts to transfer the number of bytes indicated in CX
  6935.         from a buffer to a file. If CX and AX do not match after the write,
  6936.         an error has taken place; however no error code will be returned for
  6937.         this problem. This is usually caused by a full disk.
  6938.      2) If the write is performed to STDOUT (handle 0001), it may be redirected
  6939.      3) To truncate the file at the current position of the file pointer, set
  6940.         the number of bytes in CX to zero before calling int 21h. The pointer
  6941.         can be moved to any desired position with function 42h.
  6942.      4) This function will not write to a file or device marked read-only.
  6943.      5) May also be used to display strings to CON instead of fn 09h. This
  6944.         function will write CX bytes and stop; fn 09h will continue to write
  6945.         until a $ character is found.
  6946.      6) This is the call that DOS actually uses to write to the screen in DOS
  6947.         2.x and above.
  6948.  
  6949.  
  6950. Function  41h   Delete A File From A Specified Subdirectory  (UNLINK)
  6951. entry   AH      41h
  6952.         DS:DX   pointer to ASCIIZ filespec to delete
  6953. return  CF      0       successful
  6954.                 1       error
  6955.                 AX      error code if any  (2, 5)
  6956. note 1) This function will not work on a file marked read-only
  6957.      2) Wildcards are not accepted
  6958.  
  6959.  
  6960. Function  42h   Move a File Read/Write Pointer  (LSEEK)
  6961. entry   AH      42h
  6962.         AL      method code
  6963.                 00h     offset from beginning of file
  6964.                 01h     offset from present location
  6965.                 02h     offset from end of file
  6966.         BX      file handle
  6967.         CX      most significant half of offset
  6968.         DX      least significant half of offset
  6969. return  AX      low offset of new file pointer
  6970.         DX      high offset of new file pointer
  6971.         CF      0       successful move
  6972.                 1       error
  6973.                 AX      error code (1, 6)
  6974. note 1) If pointer is at end of file, reflects file size in bytes.
  6975.      2) The value in DX:AX is the absolute 32 bit byte offset from the beginning
  6976.         of the file
  6977.  
  6978.  
  6979. Function   43h  Get/Set file attributes  (CHMOD)
  6980. entry   AH      43h
  6981.         AL      00h     get file attributes
  6982.                 01h     set file attributes
  6983.                 CX      file attributes to set
  6984.                     bit 0       read only
  6985.                         1       hidden file
  6986.                         2       system file
  6987.                         3       volume label
  6988.                         4       subdirectory
  6989.                         5       written since backup
  6990.         DS:DX   pointer to full ASCIIZ file name
  6991. return  CF      set if error
  6992.         AX      error code  (1, 2, 3, 5)
  6993.         CX      file attributes on get
  6994.                 attributes:
  6995.                 01h     read only
  6996.                 02h     hidden
  6997.                 04h     system
  6998.                 0FFh    archive
  6999. note 1) This call will not change the volume label or directory bits
  7000.  
  7001.  
  7002. Function  44h   I/O Control for Devices (IOCTL)
  7003.                 Get or Set Device Information
  7004. entry   AH      44h
  7005.         AL      00h     Get Device Information (from DX)
  7006.                         BX      file or device handle
  7007.                         return  DX      device info
  7008.                                         If bit 7 set: (character device)
  7009.                                            bit 0: console input device
  7010.                                                1: console output device
  7011.                                                2: NUL device
  7012.                                                3: CLOCK$ device
  7013.                                                4: device is special
  7014.                                                5: binary (raw) mode
  7015.                                                6: not EOF
  7016.                                               12: network device (DOS 3.x)
  7017.                                               14: can process IOCTL control
  7018.                                                   strings (func 2-5)
  7019.                                         If bit 7 clear: (file)
  7020.                                            bits 0-5: block device number
  7021.                                                 6: file has not been written
  7022.                                                12: Network device (DOS 3.x)
  7023.                                                15: file is remote (DOS 3.x)
  7024.                 01h     Set Device Information (DH must be zero for this call)
  7025.                         DX bits:
  7026.                         0    1  console input device
  7027.                         1    1  console output device
  7028.                         2    1  null device
  7029.                         3    1  clock device
  7030.                         4    1  reserved
  7031.                         5    0  binary mode - don't check for control chars
  7032.                              1  cooked mode - check for control chars
  7033.                         6    0  EOF - End Of File on input
  7034.                         7       device is character device if set, if not, EOF
  7035.                                 is 0 if channel has been written, bits 0-5 are
  7036.                                 block device number
  7037.                         12      network device
  7038.                         14   1  can process control strings (AL 2-5, can only be
  7039.                                 read, cannot be set)
  7040.                         15   n  reserved
  7041.                 02h     Read CX bytes to device in DS:DX from BX control chan
  7042.                 03h     Write Device Control String
  7043.                         BX      device handle
  7044.                         CX      number of bytes to write
  7045.                         DS:DX   pointer to buffer
  7046.                         return  AX      number of bytes written
  7047.                 04h     Read From Block Device (drive number in BL)
  7048.                         BL      drive number (0=default)
  7049.                         CX      number of bytes to read
  7050.                         DS:DX   pointer to buffer
  7051.                         return  AX      number of bytes read
  7052.                 05h     Write to Block Device  (drive number in BL)
  7053.                         AX      number of bytes transfered
  7054.                 06h     Get Input Handle Status
  7055.                         BX      file or device handle
  7056.                         return  AL      0FFh    device ready
  7057.                                         00h     device not ready
  7058.                 07h     Get Output Handle Status
  7059.                         return  AL      00h     not ready
  7060.                                         0FFh    ready
  7061.                          note: for DOS 2.x, files are always ready for output
  7062.                 08h     Removable Media Bit (DOS 3.x+)
  7063.                         return  AX      00h     device is removable
  7064.                                         01h     device is nonremovable
  7065.                                         0Fh     invalid drive specification
  7066.                 09h     Test whether Local or Network Device in BL (DOS 3.x+)
  7067.                         BL      drive number (0=default)
  7068.                         return  DX      attribute word, bit 12 set if device is
  7069.                                         remote
  7070.                 0Ah     Is Handle in BX Local or Remote? (DOS 3.x+)
  7071.                         BX     file handle
  7072.                         return DX (attribute word) bit 15 set if file is remote
  7073.                 0Bh     Change Sharing Retry Count to DX (default=3), (DOS 3.x+)
  7074.                         CX     delay (default=1)
  7075.                         DX     retry count (default=3)
  7076.                 0Ch     General IOCTL (DOS 3.3 [3.2?]) allows a device driver to
  7077.                         prepare, select, refresh, and query Code Pages
  7078.                 0Dh     Block Device Request (DOS 3.3+)
  7079.                         BL      drive number (0=default)
  7080.                         CH      major subfunction
  7081.                         CL      minor subfunction
  7082.                                 40h set device parameters
  7083.                                 41h write logical device track
  7084.                                 42h format and verify logical device track
  7085.                                 60h get device parameters
  7086.                                 61h read logical device track
  7087.                                 62h verify logical device track
  7088.                         DS:DX   pointer to parameter block
  7089.                 0Eh     Get Logical Device (DOS 3.3+)
  7090.                         BL      drive number (0=default)
  7091.                         return  AL=0 block device has only one logical drive
  7092.                                 assigned 1..n the last letter used to reference
  7093.                                 the device (1=A:,etc)
  7094.                 0Fh     Set Logical Device (DOS 3.3+)
  7095.         BL      drive number:  0=default, 1=A:, 2=B:, etc.
  7096.         BX      file handle
  7097.         CX      number of bytes to read or write
  7098.         DS:DX   data or buffer
  7099.         DX      data
  7100. return  AX      number of bytes transferred
  7101.                 or error code (call function 59h for extended error codes)
  7102.                 or status  00h     not ready
  7103.                            0FFh    ready
  7104.         CF      set if error
  7105.  
  7106.  
  7107. Function  45h   Duplicate a File Handle (DUP)
  7108. entry   AH      45h
  7109.         BX      file handle to duplicate
  7110. return  CF      clear   AX      duplicate handle
  7111.                 set     AX      error code  (4, 6)
  7112. note 1) If you move the pointed of one handle, the pointer of the other will
  7113.         also be moved.
  7114.      2) The handle in BX must be open
  7115.  
  7116.  
  7117. Function  46h   Force Duplicate of a Handle (FORCEDUP or CDUP)
  7118.                 Forces handle in CX to refer to the same file at the same
  7119.                 position as BX
  7120. entry   AH      46h
  7121.         BX      existing file handle
  7122.         CX      new file handle
  7123. return  CF      clear   both handles now refer to existing file
  7124.                 set     error
  7125.                 AX      error code (4, 6)
  7126. note 1) If CX was an open file, it is closed first
  7127.      2) If you move the read/write pointer of either file, both will move
  7128.      3) The handle in BX must be open
  7129.  
  7130.  
  7131. Function  47h   Get Current Directory
  7132.                 Places full pathname of current directory/drive into a buffer
  7133. entry   AH      47h
  7134.         DL      drive (0=default, 1=A:, etc.)
  7135.         DS:SI   points to 64-byte buffer area
  7136. return  CF      clear   DS:DI   pointer to ASCIIZ pathname of current directory
  7137.                 set     AX      error code (0Fh)
  7138. note   String does not begin with a drive identifier or a backslash
  7139.  
  7140.  
  7141. Function  48h   Allocate Memory
  7142.                 Allocates requested number of 16-byte paragraphs of memory
  7143. entry   AH      48h
  7144.         BX      number of 16-byte paragraphs desired
  7145. return  CF      clear   AX      segment address of allocated space
  7146.                         BX      maximum number paragraphs available
  7147.                 set     AX      error code (7, 8)
  7148. note    BX indicates maximum memory availible only if allocation fails
  7149.  
  7150.  
  7151. Function  49h   Free Allocated Memory
  7152.                 Frees specified memory blocks
  7153. entry   AH      49h
  7154.         ES      segment address of area to be freed
  7155. return  CF      clear   successful
  7156.                 set     AX      error code (7, 9)
  7157. note 1) This call is only valid when freeing memory obtained by function 48h.
  7158.      2) A program should not try to release memory not belonging to it.
  7159.  
  7160.  
  7161. Function  4Ah   Modify Allocated Memory Blocks (SETBLOCK)
  7162.                 Expand or shrink memory for a program
  7163. entry   AH      4AH
  7164.         BX      new size in 16 byte paragraphs
  7165.         ES      segment address of block to change
  7166. return  CF      clear   nothing
  7167.                 set     AX      error code (7, 8, 9)
  7168.                     or  BX      max number paragraphs available
  7169. note 1) Max number paragraphs availible is returned only if the call fails
  7170.      2) Memory can be expanded only if there is memory availible
  7171.  
  7172.  
  7173. Function  4Bh   Load or Execute a Program  (EXEC)
  7174. entry   AH      4Bh
  7175.         AL      00h     load and execute program. A PSP is built for the program
  7176.                         the ctrl-break and terminate addresses are set to the
  7177.                         new PSP.
  7178.                *01h     load but don't execute  (note 1)
  7179.                *01h     load but don't execute (internal, DOS 3.x & DESQview)
  7180.                *02h     load but do not execute (internal, DOS 2.x only)
  7181.                 03h     load overlay (do not create PSP, do not begin execution)
  7182.         DS:DX   points to the ASCIIZ string with the drive, path, and filename
  7183.                 to be loaded
  7184.         ES:BX   points to a parameter block for the load
  7185.                (AL=00h) word    segment address of environment string to be
  7186.                                 passed
  7187.                        dword    pointer to the command line to be placed at
  7188.                                 PSP+80h
  7189.                        dword    pointer to default FCB to be passed at PSP+5Ch
  7190.                        dword    pointer to default FCB to be passed at PSP+6Ch
  7191.               (*AL=01h) word    segment of environment (0 = use current)
  7192.                        dword    pointer to command line
  7193.                        dword    pointer to FCB 1
  7194.                        dword    pointer to FCB 2
  7195.                        dword    will hold SS:SP on return
  7196.                        dword    will hold program entry point (CS:IP) on return
  7197.               (*AL=02h) word    segment of environment (0 = use current)
  7198.                        dword    pointer to command line
  7199.                        dword    pointer to FCB 1
  7200.                        dword    pointer to FCB 2
  7201.                (AL=03h) word    segment address where file will be loaded
  7202.                         word    relocation factor to be applied to the image
  7203. return  CF      set     error
  7204.                         AX      error code (1, 2, 8, 0Ah, 0Bh)
  7205. note 1) If you make this call with AL=1 the program will be loaded as if you
  7206.         made the call with AL=0 except that the program will not be executed.
  7207.         Additionally, with AL=1 the stack segment and pointer along with the
  7208.         program's CS:IP entry point are returned to the program which made the
  7209.         4B01h call. These values are put in the four words at ES:BX+0Eh. On
  7210.         entry to the call ES:BX points to the environment address, the command
  7211.         line and the two default FCBs. This form of EXEC is used by DEBUG.COM.
  7212.      2) Application programs may invoke a secondary copy of the command
  7213.         processor (normally COMMAND.COM) by using the EXEC function.  Your
  7214.         program may pass a DOS command as a parameter that the secondary
  7215.         command processor will execute as though it had been entered from the
  7216.         standard input device.
  7217.         The procedure is:
  7218.          A. Assure that adequate free memory (17k for 2.x and 3.0, 23k for 3.1
  7219.             up) exists to contain the second copy of the command processor and
  7220.             the command it is to execute. This is accomplished by executing
  7221.             function call 4Ah to shrink memory allocated to that of your current
  7222.             requirements. Next, execute function call 48h with BX=0FFFFh. This
  7223.             returns the amount of memory availible.
  7224.         B. Build a parameter string for the secondary command processor in the
  7225.            form:
  7226.                          1 byte   length of parameter string
  7227.                         xx bytes  parameter string
  7228.                          1 byte   0Dh (carriage return)
  7229.            For example, the assembly language statement below would build the
  7230.            string to cause execution of the command FOO.EXE:
  7231.                               DB 19,"/C C:FOO",13
  7232.         C. Use the EXEC function call (4Bh), function value 0 to cause execution
  7233.            of the secondary copy of the command processor. (The drive,
  7234.            directory, and name of the command processor can be gotten from the
  7235.            COMSPEC variable in the DOS environment passed to you at PSP+2Ch.)
  7236.         D. Remember to set offset 2 of the EXEC control block to point to the
  7237.            string built above.
  7238.      3) All open files of a process are duplicated in the newly created
  7239.         process after an EXEC, except for files originally opened with the
  7240.         inheritance bit set to 1.
  7241.      4) The environment is a copy of the original command processor's
  7242.         environment. Changes to the EXECed environment are not passed back to
  7243.         the original. The environment is followed by a copy of the DS:DX
  7244.         filename passed to the child process. A zero value will cause the
  7245.         child process to inherit the environment of the calling process. The
  7246.         segment address of the environment is placed at offset 2Ch of the
  7247.         PSP of the program being invoked.
  7248.      5) This function uses the same resident part of COMMAND.COM, but makes a
  7249.         duplicate of the transient part.
  7250.      6) How EXEC knows where to return to: Basically the vector for int 22h
  7251.         holds the terminate address for the current process. When a process
  7252.         gets started, the previous contents of int 22h get tucked away in the
  7253.         PSP for that process, then int 22h gets modified. So if Process A
  7254.         EXECs process B, while Process B is running, the vector for int 22h
  7255.         holds the address to return to in Process A, while the save location in
  7256.         Process B's PSP holds the address that process A will return to when
  7257.         *it* terminates. When Process B terminates by one of the usual legal
  7258.         means, the contents of int 22h are (surmising) shoved onto the stack,
  7259.         the old terminate vector contents are copied back to int 22h vector from
  7260.         Process B's PSP, then a RETF or equivalent is executed to return control
  7261.         to process A.
  7262.      7) To load an overlay file with 4B: first, don't de-allocate the memory
  7263.         that the overlay will load into. With the other 4Bh functions, the
  7264.         opposite is true--you have to free the memory first, with function 4Ah.
  7265.         Second, the "segment address where the file will be loaded" (first item
  7266.         in the parameter block for sub-function 03) should be a paragraph
  7267.         boundary within your currently-allocated memory. Third, if the
  7268.         procedures within the overlay are FAR procs (while they execute, CS will
  7269.         be equal to the segment address of the overlay area), the relocation
  7270.         factor should be set to zero. On the other hand, if the CS register
  7271.         will be different from the overlay area's segment address, the
  7272.         relocation factor should be set to represent the difference. You
  7273.         determine where in memory the overlay file will load by using the
  7274.         segment address mentioned above. Overlay files are .EXEs (containing
  7275.         header, relocation table, and memory image).
  7276.      8) When function 00h returns, all registers are changed, including the
  7277.         stack. You must resore SS, SP, and any other required registers.
  7278.  
  7279.  
  7280. Function  4Ch   Terminate a Process (EXIT)
  7281.                 Quit with ERRORLEVEL exit code
  7282. entry   AH      4Ch
  7283.         AL      exit code in AL when called, if any, is passed to next process
  7284. return  none
  7285. note 1) Control passes to DOS or calling program
  7286.      2) return code from AL can be retrieved by ERRORLEVEL or function 4Dh
  7287.      3) all files opened by this process are closed, buffers are flushed, and
  7288.         the disk directory is updated
  7289.      4) Restores Terminate vector from PSP:000Ah
  7290.                  Ctrl-C vector from PSP:000Eh
  7291.                  Critical Error vector from PSP:0012h
  7292.  
  7293.  
  7294. Function  4Dh   Get Return Code of a Subprocess (WAIT)
  7295.                 Gets return code from functions 31h and 4Dh  (ERRORLEVEL)
  7296. entry   AH      4Dh
  7297. return  AL      exit code of subprogram (functions 31h or 4Ch)
  7298.         AH      circumstance which caused termination
  7299.                 00h     normal termination
  7300.                 01h     control-break
  7301.                 02h     critical device error
  7302.                 03h     terminate and stay resident (function 31h)
  7303. note    The exit code is only returned once
  7304.  
  7305.  
  7306. Function  4Eh   Find First Matching File (FIND FIRST)
  7307. entry   AH      4Eh
  7308.         CX      search attributes
  7309.         DS:DX   pointer to ASCIIZ filename (with attributes)
  7310. return  CF      set     AX      error code (2, 12h)
  7311.                 clear   data block written at current DTA
  7312.                         format of block is:  (info from BIX)
  7313.   documented by Micro-  |00h   1 byte   attribute byte of search
  7314.   soft as "reserved for |01h   1 byte   drive letter for search
  7315.   DOS' use on subsquent |02h   11 bytes the search name used
  7316.   Find Next calls"      |0Ch   2 bytes  word value of last entry
  7317.   function 4Fh          |0Fh   4 bytes  dword pointer to this DTA
  7318.                         |13h   2 bytes  word directory start
  7319.                         | PC-DOS 3.10 (from INTERRUP.ARC)
  7320.                         |00h   1 byte   drive letter
  7321.                         |01h-0Bh    bytes  search template
  7322.                         |0Ch   1 byte   search attributes
  7323.                         | DOS 2.x (and DOS 3.x except 3.1?) (from INTERRUP.ARC)
  7324.                         |00h   1 byte   search attributes
  7325.                         |01h   1 byte   drive letter
  7326.                         |02h-0Ch bytes  search template
  7327.                         |0Dh-0Eh 2 bytes entry count within directory
  7328.                         |0Fh-12h   bytes reserved
  7329.                         |13h-14h 2 bytes cluster number of parent directory
  7330.  
  7331.                          15h   1 byte   file attribute
  7332.                          16h   2 bytes  file time
  7333.                          18h   2 bytes  file date
  7334.                          1Ah   2 bytes  low word of file size
  7335.                          1Ch   2 bytes  high word of file size
  7336.                          1Eh  13 bytes  name and extension of file found, plus
  7337.                                         1 byte of 0s. All blanks are removed
  7338.                                         from the name and extension, and if an
  7339.                                         extension is present it is preceded by a
  7340.                                         period.
  7341. note 1) Will not find volume label
  7342.      2) This function does not support network operations
  7343.      3) Wildcards are allowed in the filespec
  7344.      4) If the attribute is zero, only ordinary files are found. If the volume
  7345.         label bit is set, only volume labels will be found. Any other attribute
  7346.         will return that attribute and all normal files together.
  7347.      5) To look for everything except the volume label, set the hidden, system,
  7348.         and subdirectory bits all to 1
  7349.  
  7350.  
  7351. Function  4Fh   Find Next Matching File (FIND NEXT)
  7352.                 Find next ASCIIZ file
  7353. entry   AH      4Fh
  7354. return  CF      clear   data block written at current DTA
  7355.                 set     AX      error code (2, 12h)
  7356. note 1) If file found, DTA is formatted as in call 4Eh
  7357.      2) Volume label searches using 4Eh/4Fh reportedly aren't 100% reliable
  7358.         under DOS 2.x. The calls sometime report there's a volume label and
  7359.         point to a garbage DTA, and if the volume label is the only item they
  7360.         often won't find it
  7361.      3) This function does not support network operations
  7362.      4) Use of this call assumes that the original filespec contained wildcards
  7363.  
  7364.  
  7365. Function  50h   "Used Internally by DOS" - Set PSP
  7366.  *              Set new Program Segment Prefix (current Process ID)
  7367. entry   AH      50h
  7368.         BX      segment address of new PSP
  7369. return  none - swaps PSP's regarded as current by DOS
  7370. note 1) By putting the PSP segment value into BX and issuing call 50h DOS stores
  7371.         that value into a variable and uses that value whenever a file call is
  7372.         made.
  7373.      2) Note that in the PSP (or PDB) is a table of 20 (decimal) open file
  7374.         handles. The table starts at offset 18h into the PSP. If there is an
  7375.         0FFh in a byte then that handle is not in use. A number in one of the
  7376.         bytes is an index into an internal FB table for that handle. For
  7377.         instance the byte at offset 18h is for handle 0, at offset 19h handle
  7378.         1, etc. up to 13h. If the high bit is set then the file associated by
  7379.         the handle is not shared by child processes EXEC'd with call 4Bh.
  7380.      3) Function 50h is dangerous in background operations prior to DOS 3.x as
  7381.         it uses the wrong stack for saving registers.  (same as functions
  7382.         0..0Ch in DOS 2.x)
  7383.      4) Under DOS 2.x, this function cannot be invoked inside an int 28h handler
  7384.         without setting the Critical Error flag
  7385.      5) Open File information, etc. is stored in the PSP DOS views as current.
  7386.         If a program (eg. a resident program) creates a need for a second PSP,
  7387.         then the second PSP should be set as current to make sure DOS closes
  7388.         that as opposed to the first when the second application finishes.
  7389.      6) See PC Mag Vol.5, No 9, p.314 for discussion.
  7390.      7) Used by DOS 3.3 PRINT & DEBUG, DesQview 2.01, Windows 1.03, SYMDEB
  7391.         from MASM 4.0
  7392.  
  7393.  
  7394. Function  51h    "Used Internally by DOS" - Get Program Segment Prefix
  7395.  *               Returns the PSP address of currently executing program
  7396. entry   AH      51h
  7397. return  BX      address of currently executing program
  7398.                 offset
  7399.                 00h     program exit point
  7400.                 02h     memory size in paragraphs
  7401.                 04h     unused (0)
  7402.                 05h     CP/M style entry point (far call to DOS)
  7403.                 0Ah     terminate address (old int 22h)
  7404.                 0Ch     terminate segment
  7405.                 0Eh     break address (old int 23h)
  7406.                 10h     break segment
  7407.                 12h     error address (old int 24h)
  7408.                 14h     error segment
  7409.                 16h     parent PSP segment
  7410.                 18h     DOS 2.0+ open files, 0FFh = unused
  7411.                 2Ch     DOS 2.0+ environment segment
  7412.                 2Eh     far ptr to process's SS:SP
  7413.                 32h     DOS 3.x max open files
  7414.                 34h     DOS 3.x openfile table address
  7415.                 36h     DOS 3.x openfile table segment
  7416.                 38h     unused by DOS versions <= 3.3
  7417.                 50h     DOS function dispatcher (FAR routine)
  7418.                 53h     unused
  7419.                 55h     FCB #1 extension
  7420.                 5Ch     FCB #1
  7421.                 6Ch     FCB #2
  7422.                 80h     command tail / default DTA buffer
  7423. note 1) Used in DOS 2.x, 3.x uses 62h
  7424.      2) Function 51h is dangerous in background operations prior to DOS 3.x as
  7425.         it uses the wrong stack for saving registers.  (same as functions
  7426.         0..0Ch in DOS 2.x)
  7427.      3) 50h and 51h might be used if you have more than one process in a PC.
  7428.         For instance if you have a resident program that needs to open a file
  7429.         you could first call 51h to save the current id and then call 50h to set
  7430.         the ID to your PSP.
  7431.      4) Under DOS 2.x, this function cannot be invoked inside an int 28h handler
  7432.         without setting the Critical Error flag
  7433.      5) Used by DOS 3.3 PRINT, DEBUG
  7434.  
  7435.  
  7436. Function  52h   "Used Internally by DOS" - IN-VARS
  7437.  *              Returns a pointer to a set of DOS data variables MCB chain,
  7438.                 pointer to first device driver and a pointer to disk parameter
  7439.                 blocks (first one)
  7440. entry   AH      52h
  7441. return  ES:BX   pointer to the DOS list of lists, for disk information. Does not
  7442.                 access the disk, so information in tables might be incorrect if
  7443.                 disk has been changed. Returns a pointer to the following array
  7444.                 of longword pointers:
  7445.                 Bytes   Value
  7446.                 -2h,-1h segment of first memory control block
  7447.                 00h-03h pointer to first DOS disk block (see function 36h)
  7448.                 04h-07h Pointer to list of DOS file tables
  7449.                         dword   pointer to next file table
  7450.                         word    number of files in this table
  7451.                                 35h bytes per file
  7452.                                 00h-01h number of file handles referring to
  7453.                                         this file
  7454.                                 02h-06h unknown
  7455.                                 07h-0Ah pointer to device driver header if
  7456.                                         character device; pointer to DOS Device
  7457.                                         Control Block if block device (see
  7458.                                         fn 32h for format)
  7459.                                 0Bh-1Fh unknown
  7460.                                 20h-2Ah filename in FCB format (no path, no
  7461.                                         period, blank-padded)
  7462.                                 2Bh-2Ch PSP segment of file's owner
  7463.                                 2Dh-30h unknown -  0 always
  7464.                                 31h-32h unknown
  7465.                                 33h-34h unknown
  7466.                 8h-0Bh  pointer to CLOCK$ device driver, whether installable or
  7467.                         resident
  7468.                 0Ch-0Fh pointer to actual CON: device driver, whether
  7469.                         installable or resident
  7470.         (DOS 2.x)
  7471.                 10      number of logical drives in system
  7472.                 11-12   maximum bytes/block of any block device
  7473.                 13-16   unknown
  7474.                 17      beginning (not a pointer. The real beginning!) of NUL
  7475.                         device driver. This is the first device on DOS's linked
  7476.                         list of device drivers.
  7477.         (DOS 3.x)
  7478.                 10h-11h maximum bytes/block of any block device (0200h)
  7479.                 12h-15h pointer to first disk buffer
  7480.                 16h-19h partially undefined: Pointer to array of drive info:
  7481.                         51h bytes per drive, starting with A: ...
  7482.                         00h-3Fh current path as ASCIIZ, starting with 'x:\'
  7483.                         40h-43h unknown    zeros always
  7484.                         44h     unknown    flags? Usually 40h, except for
  7485.                                 entry after last valid entry = 00h
  7486.                         45h-48h pointer to DOS disk block for this drive
  7487.                         49h-4Ah unknown. Current track or block?
  7488.                                 -1 if never accessed
  7489.                         4Bh-4Eh unknown  -1 always
  7490.                         4Fh-52h unknown   2 always
  7491.                 1Ah-1Dh pointer to FCB table (if CONFIG.SYS contains FCBS=)
  7492.                 1Eh-1Fh size of FCB table
  7493.                 20h     number of block devices
  7494.                 21h     value of LASTDRIVE command in CONFIG.SYS (default 5)
  7495.                 22h     beginning (not a pointer. The real beginning!) of NUL
  7496.                         device driver. This is the first device on DOS's linked
  7497.                         list of device drivers.
  7498. note 1) This call is not supported in OS/2 1.0's DOS Compatibility Box
  7499.      2) Used by DOS 4.0 MEM.EXE, DOS 3.3 ASSIGN.COM, PRINT.COM, SUBST.EXE
  7500.      3) IMPORTANT:  The structure of this list changes with EVERY version of
  7501.         DOS.  It is only partially supported by DR-DOS, and isn't supported
  7502.         under PC-MOS, OS/2's DOS box, or Wendin-DOS.  Since the information
  7503.         changes so much, I feel it should be put in the "interesting, but
  7504.         not real useful" category.  If you depend on this stuff in production
  7505.         code, you're going to regret it.
  7506.  
  7507.  
  7508. Function  53h   "Used Internally by DOS" - Translate BPB
  7509.  *              Translates BPB (BIOS Parameter Block, see below) into a DOS Disk
  7510.                 Block (see function call 32h).
  7511. entry   AH      53h
  7512.         DS:SI   pointer to BPB
  7513.         ES:BP   pointer to area for DOS Disk Block.
  7514.                 Layout of Disk Block:
  7515.                 bytes   value
  7516.                 00h-01h bytes per sector, get from DDB bytes 02h-03h.
  7517.                 02h     sectors per cluster, get from (DDB byte 4) + 1
  7518.                 03h-04h reserved sectors, get from DDB bytes 06h-07h
  7519.                 05h     number of FATs, get from DDB byte 08h
  7520.                 06h-07h number of root dir entries, get from DDB bytes 09h-0Ah
  7521.                 08h-09h total number of sectors, get from:
  7522.                         ((DDB bytes 0Dh-0Eh) - 1) * (sectors per cluster (BPB
  7523.                         byte 2)) + (DDB bytes 0Bh-0Ch)
  7524.                 0Ah     media descriptor byte, get from DDB byte 16h
  7525.                 0Bh-0Ch number of sectors per FAT, get from DDB byte 0Fh
  7526. return  unknown
  7527.  
  7528.  
  7529. Function  54h   Get Verify Setting
  7530.                 Get verify flag status
  7531. entry   AH      54h
  7532. return  AL      00h if flag off
  7533.                 01h if flag on
  7534. note    Flag can be set with function 2Eh
  7535.  
  7536.  
  7537. Function  55h   "Used Internally by DOS" - Create "Child" PSP
  7538.  *              Create PSP: similar to function 26h (which creates a new Program
  7539.                 Segment Prefix at segment in DX) except creates a "child" PSP
  7540.                 rather than copying the existing one.
  7541. entry   AH      55h
  7542.         DX      segment number at which to create new PSP.
  7543. return  unknown
  7544. note 1) This call is similar to call 26h which creates a PSP except that unlike
  7545.         call 26h the segment address of the parent process is obtained from the
  7546.         current process ID rather than from the CS value on the stack (from the
  7547.         INT 21h call). DX has the new PSP value and SI contains the value to be
  7548.         placed into PSP:2 (top of memory).
  7549.      2) Function 55 is merely a substitute for function 26h. It will copy the
  7550.         current PSP to the segment address DX with the addition that SI is
  7551.         assumed to hold the new memory top segment. This means that function
  7552.         26h sets SI to the segment found in the current PSP and then calls
  7553.         function 55h.
  7554.  
  7555.  
  7556. Function  56h   Rename a File
  7557. entry   AH      56h
  7558.         DS:DX   pointer to ASCIIZ old pathname
  7559.         ES:DI   pointer to ASCIIZ new pathname
  7560. return  CF      clear   successful rename
  7561.                 set     AX      error code (2, 3, 5, 11h)
  7562. note 1) Works with files in same drive only
  7563.      2) Global characters not allowed in filename
  7564.      3) The name of a file is its full pathname. The file's full pathname can
  7565.         be changed, while leaving the actual FILENAME.EXT unchanged. Changing
  7566.         the pathname allows the file to be "moved" from subdirectory to
  7567.         subdirectory on a logical drive without actually copying the file.
  7568.      4) DOS 3.x allows renaming of directories
  7569.  
  7570.  
  7571. Function  57h  Get/Set a File's Date and Time
  7572.                Read or modify time and date stamp on a file's directory entry
  7573. entry   AH      57h
  7574.         AL      function code
  7575.                 00h     Get Date and Time
  7576.                 01h     Set Date and Time
  7577.                         CX      time to be set
  7578.                         DX      date to be set
  7579.                 02h     unknown (DOS 4.0+)
  7580.                 03h     unknown
  7581.                 04h     unknown (DOS 4.0+)
  7582.         BX      file handle
  7583. return  CF      clear   CX      time of last write (if AL = 0)
  7584.                         DX      date of last write (if AL = 0)
  7585.                 set     AX      error code (01h, 06h)
  7586. note 1) Date/time formats are:
  7587.         CX bits 0Bh-0Fh hours (0-23)    DX bits 09h-0Fh year (relative to 1980)
  7588.                 05h-0Ah minutes (0-59)          05h-08h month (0-12)
  7589.                 00h-04h #2 sec. incr. (0-29)    00h-04h day of the month (0-31)
  7590.      2) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  7591.  
  7592.  
  7593. Function  58h   Get/Set Allocation Strategy   (DOS 3.0+)
  7594. entry   AH      58h
  7595.         AL      00h     Get Current Strategy (see 01h)
  7596.                         Used to obtain the current allocation strategy.  
  7597.                         First Fit is the normal default.
  7598.  
  7599.                 01h     Set New Current Strategy
  7600.                         BL      new strategy
  7601.                         00h     First Fit - chooses the lowest block in memory
  7602.                                 which will fit (this is the default). (use
  7603.                                 first memory block large enough)
  7604.                         01h     Best Fit - chooses the smallest block which
  7605.                                 will fill the request.
  7606.                         02h     Last Fit - chooses the highest block which will
  7607.                                 fit.
  7608.         (DOS 5.0)       40h     FIRST_FIT_HIGHONLY - search upper memory area
  7609.                                 for the lowest available block
  7610.         (DOS 5.0)       41h     BEST_FIT_HIGHONLY -  search upper memory area
  7611.                                 for the smallest block that fits the request
  7612.         (DOS 5.0)       42h     LAST_FIT_HIGHONLY -  search upper memory area
  7613.                                 for the highest available block
  7614.         (DOS 5.0)       80h     FIRST_FIT_HIGH - search upper memory area for
  7615.                                 the lowest available block. If no block found,
  7616.                                 load in conventional memory
  7617.         (DOS 5.0)       81h     BEST_FIT_HIGH - seach the upper memory area 
  7618.                                 for the closest match to the requested size.
  7619.                                 If not match is found, load in convenional
  7620.                                 memory.
  7621.         (DOS 5.0)       82h     LAST_FIT_HIGH - search the upper memory area
  7622.                                 for the available block at the highest address.
  7623.                                 If no block is found, load in conventional
  7624.                                 memory.
  7625.                 02h     Get UMB link state
  7626.                         Indicates if high DOS memory arenas are currently part
  7627.                         of the conventional DOS memory arena.
  7628.                 03h     Set UMB link state
  7629.                         BX      00h     Unlink High DOS memory blocks
  7630.                                 01h     Link High DOS memory blocks
  7631.                         note:   Adds or removes high memory blocks from the DOS
  7632.                                 arena. Returns an error if no high arenas exist.
  7633. return  CF      clear   successful
  7634.           (AL=00)       AX      strategy code (see 01h)  For DOS 5.0+,
  7635.           (AL=02)       AL      00h     if upper memory area is not linked
  7636.                                 01h     if the upper memory area is linked
  7637.                 set     error
  7638.                         AX      error code (01h)
  7639.           (AL=03)       AX      error code (01h, 07h)          
  7640. note 1) A program that changes the allocation strategy or the high DOS link
  7641.         state should ALWAYS restore it to its original condition before
  7642.         exiting, or subsequent programs may fail.
  7643.      2) The set subfunction accepts any value in BL; 2 or greater means last
  7644.         fit. The get subfunction returns the last value set, so programs should
  7645.         check whether the value is greater than or equal to 2.
  7646.      3) For discussion of best fit vs. first fit allocation strategies, see
  7647.         Knuth, *Fundamental Algorithms.* Very briefly, Knuth finds that first
  7648.         fit methods are far superior to best fit, which increases both
  7649.         allocation overhead and memory fragmentation.  The "last" fit that DOS
  7650.         offers is nothing other than a first fit, starting the search at the
  7651.         other end of the chain (the algorithm still takes the first fitting
  7652.         block that is encountered in the search).
  7653.  
  7654.  
  7655. Function  59h   Get Extended Error Code (DOS 3.0+)
  7656.       The Get Extended Error function call (59h) is intended to provide a common
  7657.      set of error codes and to supply more extensive information about the error
  7658.      to the application. The information returned from function call 59h, in
  7659.      addition to the error code, is the error class, the locus, and the
  7660.      recommended action. The error class provides information about the error
  7661.      type (hardware, internal, system, etc.). The locus provides information
  7662.      about the area involved in the failure (serial device, block device,
  7663.      network, or memory). The recommended action provides a default action for
  7664.      programs that do not understand the specific error code.
  7665.  
  7666.        Newly written programs should use the extended error support both from
  7667.      interrupt 24h hard error handlers and after any int 21h function calls. FCB
  7668.      function calls report an error by returning 0FFh in AL. Handle function
  7669.      calls report an error by setting the carry flag and returning the error
  7670.      code in AX. Int 21h handle function calls for DOS 2.x continue to return
  7671.      error codes 0-18. Int 24h handle function calls continue to return error
  7672.      codes 0-12. But the application can obtain any of the error codes used in
  7673.      the extended error codes table by issuing function call 59h. Handle
  7674.      function calls for DOS 3.x can return any of the error codes. However, it
  7675.      is recommended that the function call be followed by function call 59h to
  7676.      obtain the error class, the locus, and the recommended action.
  7677.  
  7678.        The Get Extended Error function (59h) can always be called, regardless of
  7679.      whether the previous DOS call was old style (error code in AL) or new style
  7680.      (carry bit). It can also be used inside an int 24h handler.
  7681.  
  7682.       You can either check AL or the carry bit to see if there was no error,
  7683.      and call function 59h only if there was an error, or take the simple
  7684.      approach of always calling 59h and letting it tell you if there was an
  7685.      error or not. When you call function 59h it will return with AX=0 if the
  7686.      previous DOS call was successful.
  7687.  
  7688.       Various versions of IBM's DOS, MSDOS, OEM customized versions of MSDOS,
  7689.      Digital's DRDOS, and other DOS emulating environments sometimes return
  7690.      different error codes for the same function. Be careful if you are testing
  7691.      for one specific error condition.
  7692.  
  7693. entry   AH      59h
  7694.         BX      version code (0000 for DOS 3.0 and 3.1)
  7695. return  AX      extended error code:
  7696.                 01h     Invalid function number                         2.0+
  7697.                 02h     File not found                                  2.0+
  7698.                 03h     Path not found                                  2.0+
  7699.                 04h     Too many open files, no file handles left       2.0+
  7700.                 05h     Access denied                                   2.0+
  7701.                 06h     Invalid handle                                  2.0+
  7702.                 07h     Memory control blocks destroyed                 2.0+
  7703.                 08h     Insufficient memory                             2.0+
  7704.                 09h     Invalid memory block address                    2.0+
  7705.                 0Ah     Invalid environment                             2.0+
  7706.                 0Bh     Invalid format                                  2.0+
  7707.                 0Ch     Invalid access code                             2.0+
  7708.                 0Dh     Invalid data                                    2.0+
  7709.                 0Eh     Reserved                                        2.0+
  7710.                 0Fh     Invalid drive was specified                     2.0+
  7711.                 10h     Attempt to remove the current directory         2.0+
  7712.                 11h     Not same device                                 2.0+
  7713.                 12h     No more files                                   2.0+
  7714.                 13h     Attempt to write on write-protected diskette    2.0+
  7715.                 14h     Unknown unit                                    2.0+
  7716.                 15h     Drive not ready                                 2.0+
  7717.                 16h     Unknown command                                 2.0+
  7718.                 17h     Bad CRC check                                   2.0+
  7719.                 18h     Bad request structure length                    2.0+
  7720.                 19h     Seek error                                      2.0+
  7721.                 1Ah     Unknown media type                              2.0+
  7722.                 1Bh     Sector not found                                2.0+
  7723.                 1Ch     Printer out of paper                            2.0+
  7724.                 1Dh     Write fault                                     2.0+
  7725.                 1Eh     Read fault                                      2.0+
  7726.                 1Fh     General failure                                 2.0+
  7727.                 20h     Sharing violation                               3.0+
  7728.                 21h     Lock violation                                  3.0+
  7729.                 22h     Invalid disk change                             3.0+
  7730.                 23h     FCB unavailable                                 3.0+
  7731.                 24h     Sharing buffer overflow                         3.3+
  7732.                 25h     Bad code page                                   4.0+
  7733.                 26h     Handle EOF                                      4.0+
  7734.                 27h     Handle disk full                                4.0+
  7735.                 28h     Reserved
  7736.                 29h        "
  7737.                 2Ah        "
  7738.                 2Bh        "
  7739.                 2Ch        "
  7740.                 2Dh        "
  7741.                 2Eh        "
  7742.                 2Fh        "
  7743.                 30h        "
  7744.                 31h     Reserved
  7745.                 32h     Network: request not supported                  3.1+
  7746.                 33h     Network: remote computer not listening          3.1+
  7747.                 34h     Network: duplicate name on network              3.3+
  7748.                 35h     Network: name not found                         3.3+
  7749.                 36h     Network: busy                                   3.3+
  7750.                 37h     Network: device no longer exists                3.3+
  7751.                 38h     Network: NETBIOS command limit exceeded         3.3+
  7752.                 39h     Network: adapter hardware error                 3.3+
  7753.                 3Ah     Network: incorrect response from network        3.3+
  7754.                 3Bh     Network: unexpected network error               3.3+
  7755.                 3Ch     Network: incompatible remote adapter            3.3+
  7756.                 3Dh     Network: print queue full                       3.3+
  7757.                 3Eh     Network: not enough space for print file        3.3+
  7758.                 3Fh     Network: print file was deleted                 3.3+
  7759.                 40h     Network: name was deleted                       3.3+
  7760.                 41h     Network: access denied                          3.3+
  7761.                 42h     Network: device type incorrect                  3.3+
  7762.                 43h     Network: name not found                         3.3+
  7763.                 44h     Network: name limit exceeded                    3.3+
  7764.                 45h     Network: NETBIOS session limit exceeded         3.3+
  7765.                 46h     Network: sharing temporarily paused             3.3+
  7766.                 47h     Network: request not accepted                   3.3+
  7767.                 48h     Network: print or disk redirection paused       3.1+
  7768.                 49h     Reserved
  7769.                 4Ah        "
  7770.                 4Bh        "
  7771.                 4Ch        "
  7772.                 4Dh        "
  7773.                 4Eh        "
  7774.                 4Fh     Reserved
  7775.                 50h     File exists                                     3.3+
  7776.                 51h     Reserved                                        3.3+
  7777.                 52h     Cannot make directory entry                     4.0+
  7778.                 53h     Fail on interrupt 24h                           3.3+
  7779.                 54h     Network: too many redirections                  3.3+
  7780.                 55h     Network: duplicate redirection                  3.3+
  7781.                 56h     Invalid password                                3.3+
  7782.                 57h     Invalid parameter                               3.3+
  7783.                 58h     Network: data fault (write error)               3.3+
  7784.                 59h     Reserved
  7785.                 5Ah     Comp not loaded                                 5.0+
  7786.         BH      class of error:                          (DOS 5.0 name)
  7787.                 01h     Out of resource                 ERRCLASS_OUTRES
  7788.                         (not enough disk space, etc)
  7789.                 02h     Temporary situation             ERRCLASS_TEMPSIT
  7790.                         (not an error, but a temporary situation that is
  7791.                          expected to end, such as a locked region in a file)
  7792.                 03h     Authorization                   ERRCLASS_AUTH
  7793.                         (denied access - sharing or network)
  7794.                 04h     Internal                        ERRCLASS_INTRN
  7795.                         (DOS internal error)
  7796.                 05h     Hardware failure                ERRCLASS_HRDFAIL
  7797.                         (bad floppy or HD controller, etc.)
  7798.                 06h     System failure                  ERRCLASS_SYSFAIL
  7799.                         (error not due to executing program, such as
  7800.                          missing configuration or data files)
  7801.                 07h     Application program error       ERRCLASS_APPERR
  7802.                         (executing program bombed)
  7803.                 08h     Not found                       ERRCLASS_NOTFND
  7804.                         (file or device not found)
  7805.                 09h     Bad format                      ERRCLASS_BADFMT
  7806.                         (file or item invalid format or type)
  7807.                 0Ah     Locked                          ERRCLASS_LOCKED
  7808.                         (network or SHARE lock)
  7809.                 0Bh     Media error                     ERRCLASS_MEDIA
  7810.                         (wrong volume ID, disk failure)
  7811.                 0Ch     Already exists                  ERRCLASS_ALREADY
  7812.                         (file or device already exists)
  7813.                 0Dh     Unknown                         ERRCLASS_UNK
  7814.                         (Smurfs infesting system board)
  7815.         BL      suggested action code:
  7816.                 01h     Retry                           ERRACT_RETRY
  7817.                 02h     Delayed retry                   ERRACT_DLYRET
  7818.                 03h     Prompt user                     ERRACT_USER
  7819.                 04h     Abort after cleanup             ERRACT_ABORT
  7820.                 05h     Immediate abort                 ERRACT_PANIC
  7821.                 06h     Ignore                          ERRACT_IGNORE
  7822.                 07h     Retry after user intervention   ERRACT_INTRET
  7823.         CH      locus (where error occurred):
  7824.                 01h     Unknown or not appropriate      ERRLOC_UNK
  7825.                 02h     Block device                    ERRLOC_DISK
  7826.                 03h     Network related                 ERRLOC_NET
  7827.                 04h     Serial device                   ERRLOC_SERDEV
  7828.                 05h     Memory related                  ERRLOC_MEM
  7829. note 1) Not all DOS functions use the carry flag to indicate an error. Carry
  7830.         should be tested only on those functions which are documented to use it.
  7831.      2) None of the DOS functions which existed before 2.0 use the carry
  7832.         indicator.  Many of them use register AL as an error indication instead,
  7833.         usually by putting 0FFh in AL on an error. Most, but not all, the "new"
  7834.         (2.x, 3.x) functions do use carry, and most, but not all, of the "old"
  7835.         (1.x) functions use AL.
  7836.      3) On return, CL, DI, DS, DX, ES, BP, and SI are destroyed - save before
  7837.         calling this function if required.
  7838.      4) DOS 2.x Error Codes:  If you are using function calls 38h-57h with DOS
  7839.         2.x, to check if an error has occurred, check for the following error
  7840.         codes in the AX register:
  7841.         call    error code      call    error code      call    error code
  7842.         38h     2               41h     2,3,5           4Ah     7,8,9
  7843.         39h     3,5             42h     1,6             4Bh     1,2,3,5,8,10,11
  7844.         3Ah     3,5,15          43h     1,2,3,5         4Eh     2,3,18
  7845.         3Bh     3               44h     1,3,5,6         4Fh     18
  7846.         3Ch     3,4,5           45h     4,6             56h     2,3,5,17
  7847.         3Dh     2,3,4,5,12      46h     4,6             57h     1,6
  7848.         3Eh     6               47h     15
  7849.         3Fh     5,6             48h     7,8
  7850.         40h     5,6             49h     7,9
  7851.      5) Note that extended error codes 13h through 1Fh correspond to error
  7852.         codes 00h through 0Ch returned by int 24h.
  7853.      6) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  7854.  
  7855.  
  7856. Function  5Ah   Create Temporary File
  7857.                 Create unique filename (for temporary use) (DOS 3.0+)
  7858. entry   AH      5Ah
  7859.         DS:DX   pointer to buffer containing an ASCIIZ directory pathname
  7860.                 ending with a backslash (\). The buffer must have at least 13
  7861.                 bytes free following the backslash, as the file name and
  7862.                 extension will be written there.
  7863.         CX      file attribute (00h, 01h, 02h, 04h, 20h only)
  7864. return  CF      clear   AX      handle
  7865.                         DS:DX   new ASCIIZ pathname
  7866.                 set     AX      error code (03h, 04h, 05h)
  7867. note 1) The file created is not truly "temporary". It must be removed by the
  7868.         user.
  7869.      2) If the filename created already exists in the current directory, this
  7870.         function will call itself again with another unique filename until
  7871.         a unique filename is found.
  7872.      3) The temporary filename usually consists of mixed letters and numbers.
  7873.         No file extension appears to be generated.
  7874.      4) DOS 3.0-4.01 used mixed letters and numbers.  MS DOS 5.0 appears to use
  7875.         letters only.  DR DOS 5.0 appears to use numbers only.
  7876.      5) Under DOS 3.1+ networks, DOS opens the file in compatibility mode.
  7877.      6) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  7878.      7) For PC-MOS/386 native mode, use DS:EDX instead of DS:DX.
  7879.  
  7880.  
  7881. Function  5Bh   Create a New File   (DOS 3.0+)
  7882. entry   AH      5Bh
  7883.         DS:DX   segment/offset pointer to an ASCIIZ pathname
  7884.         CX      file attribute (00h, 01h, 02h, 04h, 20h only)
  7885. return  CF      clear   AX      file handle
  7886.                         DS:DX   new ASCIIZ pathname
  7887.                 set     AX      error code (03h, 04h, 05h, 50h)
  7888. note 1) Unlike function 3Ch, function 5Bh will fail if the file already exists.
  7889.         This is useful on networks, since another application might create a
  7890.         file of the same name with 3Ch first, causing the first 3Ch to fail.
  7891.         Use of this call instead of 3Ch is good practice for code that will not
  7892.         need to run under DOS 2.x.
  7893.      2) Under DOS 3.1+ networks, DOS opens the file in read/write mode. This
  7894.         call will fail if the user does not have Create access.
  7895.      3) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  7896.      4) The MSDOS Encyclopedia suggests this call may be used to implement
  7897.         semaphores in LANs or multitasking environments.  A zero-byte marker
  7898.         file could be created to indicate semaphore set.
  7899.      5) For PC-MOS/386 native mode, use DS:EDX instead of DS:DX.
  7900.  
  7901.  
  7902. Function  5Ch   Lock/Unlock File Access   (DOS 3.0+)
  7903. entry   AH      5Ch
  7904.         AL      00h     to lock file region
  7905.                 01h     to unlock file region
  7906.         BX      file handle
  7907.         CX:DX   4-byte starting offset from beginning of file of region to lock
  7908.         SI:DI   4-byte integer, high/low size of region to lock (in bytes)
  7909. return  CF      clear   successful
  7910.                 set     AX      error code (01h, 06h, 21h, 24h)
  7911. note 1) Unlock all files before exiting or undefined results may occur.
  7912.         Programs using file locking should trap int 23h (Control-C Handler
  7913.         Address) and int 24h (Critical Error Handler Address) and unlock files
  7914.         before returning to the caller.
  7915.      2) Programs spawned with EXEC inherit all the parent's file handles but
  7916.         not the file locks.
  7917.      3) This call is explicitly supported in the OS/2 DOS Compatibility Box.
  7918.      4) You may lock an entire file, any part of a file, or several parts of
  7919.         the same file. For example, it would be more efficient to lock an
  7920.         area in a database containing a single record than to lock the entire
  7921.         file. If two adjacent sections of a file are locked separately, they
  7922.         must be unlocked separately - you cannot change the lock pointers and
  7923.         use a single unlock call.
  7924.      5) You should lock only as much of a file as you need and keep the lock
  7925.         only for as long as necessary. Should a file need to be shared and
  7926.         updated often, continual locking and unlocking can slow file access
  7927.         detectably.
  7928.      6) This call returns error 01h if SHARE is not loaded.
  7929.      7) Locked files must be unlocked before the program terminates, or
  7930.         the result is undefined.
  7931.      8) A transaction-oriented algorithm for using locking is recommended.
  7932.         In effect, assert lock, read data, change data, remove lock.  An
  7933.         application should release its lock when a transaction is complete.
  7934.      9) Locking past end-of-file does not cause an error.
  7935.     10) Locking a portion of a file with fn 5Ch denies all other processes 
  7936.         both read and write access to the locked region.
  7937.     11) For PC-MOS/386 native mode, use ECX and EDX instead of CX:DX.
  7938.  
  7939.  
  7940. Function  5Dh   Multifunction, DOS  Internal - partial (DOS 3.x+)
  7941. entry   AH      5Dh
  7942.         AL      subfunction
  7943.                 00h     Indirect Function Call
  7944.                         DS:DX   pointer to buffer containing register values
  7945.                                 AX, BX, CX, DX, SI, DI, DS, ES for a call to
  7946.                                 int 21h
  7947.                         return  as appropriate for function being called
  7948.                         note    Does not check AH. Out of range values will
  7949.                                 crash the system.
  7950.                 01h     SYNC?  (DOS 3.1+)
  7951.                         parameters unknown
  7952.                         note 1) Does something to each disk file in the system.
  7953.                                 File Table which has been written to.
  7954.                              2) If remote file, calls int 2Fh/fn1107h.
  7955.                              3) Seems to update the time stamp of all open
  7956.                                 files which have been written to.
  7957.                 02h     SHARE.EXE? (DOS 3.1+)
  7958.                         note    Error unless SHARE is loaded (calls fn 52h+4Ah)
  7959.                 03h     SHARE.EXE? (DOS 3.1+)
  7960.                         note    Error unless SHARE is loaded (calls fn 52h+4Ah)
  7961.                 04h     SHARE.EXE functions? (DOS 3.1+)
  7962.                         note    Error unless SHARE is loaded (calls fn 52h+4Ah)
  7963.                 05h     Network functions? (DOS 3.1+)
  7964.                         DS:DX   pointer to buffer (see AX=0Ah), only fields at
  7965.                                 offset 12h, 14h used
  7966.                         note    Error unless SHARE is loaded (calls fn 52h+5Ah)
  7967.                 06h     Get Address of Critical Error Flag
  7968.                         DS:DX   pointer to buffer (see 0Ah), only fields at
  7969.                                 offset 12h, 14h used
  7970.                         return  CX      unknown value
  7971.                                 DX      unknown value
  7972.                                 DS:SI   pointer to critical error flag
  7973.                         notes   This call does a lot of other work in addition
  7974.                                 to returning the pointer setting CritErr flag
  7975.                                 allows use of functions 50h/51h from int 28h
  7976.                                 under DOS 2.x by forcing use of correct stack.
  7977.     (LANtastic) 07h     Return redirected printer mode
  7978.                         return  DL      00      output is being combined
  7979.                                         01h     output is being separated
  7980.                         note    The current printer mode (either printer output
  7981.                                 combined or separated) is returned.
  7982.     (LANtastic) 08h     Set redirected printer mode (either printer output
  7983.                         DL      00h     set redirected output to be combined
  7984.                                 01h     set redirected output to be separated.
  7985.                                         (implicitly starts a new print job)
  7986.                         return  none
  7987.                         note 1) The current printer mode (either printer output
  7988.                                 combined or separated) can be set.
  7989.                              2) may be used by COMMAND.COM
  7990.     (LANtastic) 09h     Flush printer output
  7991.                         return  none
  7992.                         note 1) Printer output is flushed and a new print job
  7993.                                 is started. If no output exists to be flush
  7994.                                 then this function has no effect.
  7995.                              2) may be used by COMMAND.COM
  7996.                 09h     unknown - may be used by COMMAND.COM
  7997. (DOS 5, doc'd)  0Ah     Set Extended Error Information
  7998.                         DS:DX   address of 11-word error information table
  7999.                                 format of error information table:
  8000.                                 offset  size    description
  8001.                                 00h    word    value that next call to fn 59h
  8002.                                                will return in AX
  8003.                                 02h    word    value that next call to fn 59h
  8004.                                                will return in BX
  8005.                                 04h    word    CX
  8006.                                 06h    word    DX
  8007.                                 08h    word    SI
  8008.                                 0Ah    word    DI
  8009.                                 0Ch    word    DS
  8010.                                 0Eh    word    ES
  8011.                                 10h    word    reserved (set to 0)
  8012.                                 12h    word    user (computer) ID, 0=local
  8013.                                 14h    word    program ID, 0=local program
  8014.                 return  none
  8015. return   DS:SI   (for 06h) pointer to critical error flag
  8016. note 1) Function 0Ah; DOS 3.1+.
  8017.      2) Function 06h; setting CritErr flag allows use of functions 50h/51h from
  8018.         int 28h under DOS 2.x by forcing the use of the correct stack.
  8019.      3) Functions 07h, 08h, 09h are identical in DOS 3.1 and call int 2Fh
  8020.         fn1125h.
  8021.  
  8022.  
  8023. Function  5Eh   Network Printer
  8024.                 DOS 3.1+ with Networks software
  8025.                 PC-MOS/386 through 4.1 has limited support for functions
  8026.                 5Eh through 5F04h.  The MOS NETBIOS driver must be loaded.
  8027.                 A device name is returned for 5E00h and an "end of list"
  8028.                 status is returned for other functions.
  8029. entry   AH      5Eh
  8030.         AL      00h     Get Machine Name
  8031.                         DS:DX   pointer to 16-byte buffer for ASCIIZ name
  8032.                         return  CH      00h     if name not defined
  8033.                                         <>0     name is defined
  8034.                                 CL      00h     name not set
  8035.                                         <>0     NetBIOS name number
  8036.                                 DS:DX   pointer to ASCIIZ name if CH <>0
  8037.                                 CF      set on error
  8038.                                         AX      error code (01h)
  8039.                         note 1) The ASCIIZ name is a 15 byte string padded
  8040.                                 to length with zeroes.
  8041.                              2) The NETBIOS number in CL and name at DS:DX are
  8042.                                 valid only if the value returned in CH is <>0.
  8043.                 01h     Set Machine Name
  8044.                         CH      00h     undefine name
  8045.                                 <>0     define name
  8046.                         CL      name number
  8047.                         DS:DX   pointer to ASCIIZ name
  8048.                 02h     Set Printer Control String
  8049.                         BX      redirection list index
  8050.                         CX      length of setup string (max 64 bytes)
  8051.                         DS:SI   pointer to ASCIIZ setup string buffer
  8052.                         return: CF      set on error
  8053.                                         AX      error code (01h)
  8054.                         note 1) Set printer setup sets a setup string to be
  8055.                                 sent to the network printer whenever a file is
  8056.                                 queued to the printer.
  8057.                              2) LANtastic LANOS does not process this request
  8058.                                 since printer setup strings are controlled by
  8059.                                 the system administer using the NET_MGR
  8060.                                 program. The system call does not return an
  8061.                                 error, however.
  8062.                 03h     Get Printer Control String
  8063.                         BX      redirection list index
  8064.                         ES:DI   pointer to 64-byte string buffer
  8065.                         return  CX      length of setup string (max 64 bytes)
  8066.                         return: CF      set on error
  8067.                                         AX      error code (01h)
  8068.                         note 1) This call will return the setup string set with
  8069.                                 fn 02h above.
  8070.                              2) LANtastic LANOS does not process this request
  8071.                                 since printer setup strings are controlled by
  8072.                                 the system administer using the NET_MGR program.
  8073.                                 The system call does not return an error,
  8074.                                 however, and the length of the setup string
  8075.                                 (CX) is 0.
  8076.                 04h     DOS 3.1+ +Microsoft Networks - unknown
  8077.                         note    Calls int 2F/AX=111Fh with 5E04h on stack.
  8078.                 05h     DOS 3.1+ +Microsoft Networks - unknown
  8079.                         note    Calls int 2F/AX=111Fh with 5E05h on stack.
  8080.                 06h     DOS 3.1+ +Microsoft Networks - unknown
  8081.                         note    Calls int 2F/AX=111Fh with 5E06h on stack.
  8082. return  CF      clear   successful
  8083.                 set     error
  8084.                         AX      error code (01h for all listed subfunctions)
  8085. note 1) Used in IBM's & Microsoft's Network programs.
  8086.      2) Partial documentation in Fall 1985 Byte, in Advanced MS-DOS, in MS-DOS
  8087.         Encyclopedia, LANtastic Programmer's Manual.  
  8088.      3) These services require that the network software be installed.
  8089.      4) SHARE must be loaded or results can be unpredictable on 00h, or fail
  8090.         with 02h or 03h.
  8091.      5) The redirection entry index is an index into a table that identifies
  8092.         the printer as a device on the network.
  8093.  
  8094.  
  8095. Function  5Fh   Network Redirection
  8096.                 (DOS 3.1+ and Microsoft Networks)
  8097. entry   AH      5Fh
  8098.         AL     *00h     Unknown
  8099.                *01h     Unknown
  8100.                 02h     Get Redirection List Entry
  8101.                         BX      redirection entry index. Index 0 specifies the
  8102.                                 first entry
  8103.                         DS:SI   pointer to 16 byte area which will receive the
  8104.                                 ASCIIZ local device name
  8105.                         ES:DI   pointer to 128 byte buffer for the ASCIIZ
  8106.                                 network device name
  8107.                         return  CF      set on error
  8108.                                         AX      error code (01h, 12h)
  8109.                                 BH      device status flag (bit 0=0 if valid)
  8110.                                                            (bit 0=1 if invalid)
  8111.                                                            (bits 1-7 reserved)
  8112.                                 BL      device type
  8113.                                         03      printer device
  8114.                                         04      drive device (file)
  8115.                                 CX      value stored by fn 03h call. Should be
  8116.                                         0 for compatiblity with LANOS
  8117.                                 DS:SI   pointer to 16 byte ASCIIZ local device
  8118.                                         name
  8119.                                 ES:DI   pointer to 128 byte ASCIIZ network name
  8120.                         note 1) DX and BP are destroyed by this call.
  8121.                              2) This call returns information about a single
  8122.                                 redirected device (see fn 03h). This fn may be
  8123.                                 used to scan the list of redirected devices.
  8124.                 03h     Redirect Device - Make Assign List Entry
  8125.                         Redirects a workstation drive or device to a server
  8126.                         directory or device.
  8127.                         AX      error code if error
  8128.                         BL      device type
  8129.                                 03h     printer device
  8130.                                 04h     file device
  8131.                         CX      stored parameter value (0 for compatibility
  8132.                                 with IBM PC Network program and LANtastic)
  8133.                         DS:SI   pointer to 16-byte ASCIIZ source device name
  8134.                                 for printer specify: PRN, LPT1, LPT2, LPT3
  8135.                         ES:DI   pointer to destination 128-byte ASCIIZ network
  8136.                                 path and ASCIIZ password
  8137.                                 (e.g.,'\\machine_name\path',0,'password',0)
  8138.                         return  CF      set on error
  8139.                                         AX      error code (01h, 03h, 05h, 08h, 
  8140.                                                             0Fh, 12h)
  8141.                         note 1) Redirect device allows you to connect local
  8142.                                 devices to network paths. For example you can
  8143.                                 connect your LPT1 to a printer on another node.
  8144.                                 References to LPT1 are routed to the network.
  8145.                              2) If the password is omitted, the pathname must
  8146.                                 be followed by two null bytes.
  8147.                              3) For printer redirection, MS-Net intercepts int
  8148.                                 17h. When redirection is canceled, all printing
  8149.                                 is sent to the first local printer. (LPT1)
  8150.                 04h     Cancel Redirection Assignment
  8151.                         DS:SI   pointer to ASCIIZ device name or network path
  8152.                                 to be canceled
  8153.                         return  CF      set on error
  8154.                                         AX      error code (01h, 03h, 05h, 08h, 
  8155.                                                             0Fh, 12h)
  8156.                         note 1) Cancel device redirection allows you to remove
  8157.                                 a device redirection so that the device is
  8158.                                 restored to its former state.
  8159. return  CF      clear   successful
  8160.                 set     if error
  8161.                         AX      error code
  8162.                                 (fn 02h) 01h, 12h
  8163.                                 (fn 03h) 01h, 03h, 05h, 08h
  8164.                                 (fn 04h) 01h, 0Fh
  8165. note 1) Used in IBM's Network program and Microsoft MS-Networks.
  8166.      2) Partial documentation in Fall 1985 Byte, in Advanced MS-DOS, in MS-DOS
  8167.         Encyclopedia, LANtastic Programmer's Manual.  
  8168.      3) These services require that the network software be installed.
  8169.      4) SHARE must be loaded or the call will fail.
  8170.      5) The network device name requires a password.
  8171.      6) Only printer and disk devices are supported for redirection. STDAUX,
  8172.         STDIN, STDOUT, and STERR are not supported by the Microsoft/IBM
  8173.         specification.  Other companies have managed to do this with various
  8174.         nonstandard additions to the API.
  8175.  
  8176.  
  8177. Function  60h   Parse pathname  (TRUENAME)     (DOS 3.0+)
  8178.  *              Perform name processing on a string (internal to DOS)
  8179. entry   AH      60h
  8180.         DS:SI   pointer to ASCIIZ source string (null terminated)
  8181.         ES:DI   pointer to destination 80 byte ASCIIZ string buffer
  8182. return  ES:DI   buffer filled with qualified name in form (drive):(path)
  8183.         CF      set     error
  8184.                         AX      error code (02h, 03h)
  8185.                 clear   no error
  8186. note 1) Documented in Zenith 3.05 Technical Reference.
  8187.      2) All name processing is performed on the input string: string
  8188.         substitution is performed on the components, current drive/directories
  8189.         are prepended, .  and ..  are removed. Under most networking software,
  8190.         the drive letter is replaced with the node name, i.e. returns pathname
  8191.         like \\utils\test.txt instead of F:\utils\test.txt
  8192.      3) Example: If current drive/directory is c:\test,  myfile.x is translated
  8193.         to c:\test\myfile.x; ..\source\sample.asm is tranlated to c:\source\
  8194.         sample.asm.
  8195.      4) It is the caller's responsibility to make sure DS:SI does not point to
  8196.         a null string. If it does, SI is incremented, a null byte is stored at
  8197.         ES:DI, and the routine returns.
  8198.      5) Used by CHKDSK, at least in DOS 3.3, and DOS 3.x.
  8199.      6) If path string is on a JOINed drive, the returned name is the one that
  8200.         would be needed if the drive were not JOINed; similarly for a SUBSTed
  8201.         drive letter. Because of this, it is possible to get a qualified name
  8202.         that is not legal with the current combination of SUBSTs and JOINs.
  8203.      7) Used by DOS 4.0 SHELLC.EXE.
  8204.      8) This call has been discovered in DOS versions as early as 2.11.
  8205.      9) In Novell Netware 2.1x, this call is not supported when the 8th bit
  8206.         (high ASCII) is set on any letter in the file or pathname, and when
  8207.         the file being inquired about is on a remote drive. This causes
  8208.         problems with machines using foreign code pages.
  8209.     10) You need DPMI services to use this call under MS Windows 3.x.  There
  8210.         is an example in PC Magazine, 25 June 1991, p. 389 called TRUENAME.C.
  8211.  
  8212.  
  8213. Function  61h   undocumented - (DOS 3.0)
  8214.  *              Internal to DOS - parameters not known
  8215. entry   AH      61h
  8216. return  AL      00h
  8217. note    Supposedly documented in Zenith DOS 3.05 Technical Reference.
  8218.  
  8219.  
  8220. Function  62h   Get Program Segment Prefix (PSP) (DOS 3.0+)
  8221. entry   AH      62h
  8222. return  BX      segment address of PSP
  8223. note    Under DOS 3.x+, this function does not use any of DOS' internal stacks
  8224.         and is thus fully reentrant.
  8225.  
  8226.  
  8227. Function  63h   Get Lead Byte Table  (MS-DOS 2.25 only)
  8228.                 Added in DOS 2.25 for additional foreign character set support.
  8229. entry   AH      63h
  8230.         AL      subfunction
  8231.                 00h     get system lead byte table address
  8232.                 01h     set/clear interim console flag
  8233.                         DL      0000h   to clear interim console flag
  8234.                                 0001h   to set interim console flag
  8235.                 02h     get interim console flag
  8236. return  DS:SI   pointer to lead byte table (AL = 00h)
  8237.         DL      interim console flag (AL = 02h)
  8238. note 1) Function 63h destroys all registers except SS:SP on return. To avoid
  8239.         saving registers repeatedly, a process can copy the table or save the
  8240.         pointer for later use.
  8241.      2) Works ONLY in MS-DOS 2.25!
  8242.      3) Note fn 63h does not return errors in AL or CF.
  8243.      4) Original support was for Kanji (Japanese) and Hanegul (Korean) only.
  8244.      5) The lead byte table contains pairs of bytes that represent the
  8245.         inclusive boundary values for the lead bytes of the specified
  8246.         alphabet.  Because of the way bytes are ordered by the 8086 micro-
  8247.         processor family, the values must be read as byte values, not as word
  8248.         values.
  8249.      6) If the interim console flag is set (DL=0001h) by a program through a
  8250.         call to fn 63h, the following int 21h functions return interim character
  8251.         information on request: 07h, 08h, 0Bh, 0Ch.
  8252.  
  8253.  
  8254. Function  64h   Undocumented - Used internally by DOS
  8255. entry   AH      64h
  8256. return  unknown
  8257. note 1) DOS 3.2+ internal function of some type? May be a network function.
  8258.      2) In DOS 3.31 it seems that when you load AL with a nonzero number,
  8259.         int 28h will get called more often. AL=0 resets back to the "boot up"
  8260.         state.
  8261.  
  8262.  
  8263. Function  65h   Get Extended Country Information (DOS 3.3+)
  8264.                 Returns information about the selected country formats, code
  8265.                 pages, and conversion tables
  8266. entry   AH      65h
  8267.         AL      information ID code
  8268.                 01h     get general internationalization info
  8269.                 02h     get pointer to uppercase table (130 bytes max)
  8270.                         (maps chars 80h-0FFh to their uppercase equivalents,
  8271.                          if any; used mainly to map accented or other vowels
  8272.                          to the corresponding plain vowels)
  8273.                 03h     unknown
  8274.                 04h     get pointer to filename uppercase table (130 bytes max)
  8275.                         (similar to table for AL = 02h)
  8276.    (DOS 5.0+)   05h     get filename character table - specifies which chars
  8277.                         must not be used in filenames.
  8278.                 06h     get pointer to collating sequence table (258 bytes max)
  8279.                         (maps uppercase, lower, and accented chars together
  8280.                          for sorting)
  8281.                 07h     get pointer to double-byte character set table
  8282.    (DOS 5.0+)   20h     convert character - converts character in DL to
  8283.                         uppercase using the current uppercase table
  8284.    (DOS 5.0+)   21h     convert string - converts string in DS:DX, length CX
  8285.                         to uppercase using current uppercase table, returns in
  8286.                         DS:DX
  8287.    (DOS 5.0+)   22h     convert ASCIIZ string - converts string in DS:DX
  8288.                         to uppercase using current uppercase table, returns
  8289.                         in DS:DX
  8290.  
  8291.         BX      code page (0FFFFh = current code page)
  8292.         CX      amount of information to be returned (minimum 5)
  8293.         DX      target country ID (0FFFFh = default current country)
  8294.         ES:DI   segment/offset pointer to country information buffer
  8295. return  CF      set on error
  8296.                 AX      error code (02h)
  8297.                         otherwise:
  8298.         CX      size of country information returned
  8299.         ES:DI   pointer to country information:
  8300.               offset   length   description
  8301.                 00h   1 byte    info ID  (for all following buffers)
  8302.         If information ID code <> 1:
  8303.                 01h     dword  pointer to information
  8304.         If information ID code = 1:
  8305.                 01h     word    length of remainder of buffer (<= 38)
  8306.                 03h     word    country ID
  8307.                 05h     word    code page number
  8308.                 07h  34 bytes   same as for int 21h function 38h
  8309.         If information ID code = 2:
  8310.                 01h     word    table size
  8311.                 05h     dword   pointer to uppercase table
  8312.             128 bytes uppercase equivalents (if any) of chars 80h-0FFh
  8313.         If information ID code = 4:
  8314.                 01h     word    table size
  8315.                 05h     dword   pointer to collating table
  8316.             256 bytes   values used to sort characters 00h-0FFh
  8317.         If information ID code = 6:
  8318.                 01h     word    table size
  8319.                 05h     dword   pointer to filename uppercase table. This
  8320.                                 table starts with a 2-byte length field, then
  8321.                                 256 ASCII values placed in order
  8322.             128 bytes   uppercase equivalents (if any) of chars 80h-0FFh
  8323.         If information ID code = 7: (DOS 4.0)
  8324.                 unknown
  8325. note 1) For AL=02h, 04h, or 06h, the first two bytes of the table give its
  8326.         length and then a 128 byte table of uppercase ASCII characters for
  8327.         02h or 04h and a pointer to the collating sequence for 06h.
  8328.      2) The country code and code page must match. If not, error 02h is in AX.
  8329.      3) If more information is provided than was requested by CX, it is
  8330.         truncated without generating an error.
  8331.      4) Country information:
  8332.         bytes   description
  8333.         01h     value of AL (01h)
  8334.         02h,03h size (max = 38)
  8335.         04h,05h country code
  8336.         06h,07h code page
  8337.         08h,09h date format
  8338.         0Ah,0Eh currency symbol
  8339.         0Fh,10h thousands separator
  8340.         11h,12h decimal separator
  8341.         13h,14h date separator
  8342.         15h,16h time separator
  8343.         17h     currency format flags
  8344.         18h     digits in currency
  8345.         19h     time format
  8346.         20h-22h monocase routine entry point
  8347.         23h-24h data list separator
  8348.         25h-29h zeros
  8349.  
  8350.  
  8351. Function  66h   Get/Set Global Code Page Table (DOS 3.3+)
  8352.                 Query/reset code page defaults
  8353. entry   AH      66h
  8354.         AL      00h     Get Global Code Page
  8355.                 01h     Set Global Page
  8356.                         BX      active code page
  8357.                         DX      system code page (active page at boot time)
  8358. return  CF      clear  successful
  8359.                 set    AX       error code (unknown)
  8360.         if 00h         BX       active code page
  8361.                        DX       system code page (active page at boot time)
  8362. note 1) BX = active code page: 437 = US, 860 = Portugal, 863 = Canada (French)
  8363.                                865 = Norway/Denmark, 850 = multilingual
  8364.      2) MS 5.0 TR shows fns as 01h and 02h.
  8365.  
  8366.  
  8367. Function  67h   Set Handle Count  (DOS 3.3+)
  8368.                 Supports more than 20 open files per process
  8369. entry   AH      67h
  8370.         BX      desired number of handles (20 to 65,535)
  8371. return  CF      clear   if OK
  8372.                 set     if error
  8373.                 AX      error code (unknown)
  8374. note 1) This function changes the 20-byte handle table pointer in the PSP to
  8375.         point to a new, larger handle table elsewhere in memory.
  8376.      2) The memory the 67h call allocates is taken from the normal DOS pool,
  8377.         and is reclaimed on process termination, so nothing is lost.
  8378.      3) When calling this function you must release enough memory for DOS to
  8379.         contain the extended handle list.
  8380.      4) If the requested number of handles is less than 20 nothing is done.
  8381.      5) Early versions of PC-MOS/386 v4.1 did not properly deallocate memory
  8382.         when the number of handles was reduced.
  8383.      6) The error value returned in AX is not documented in the IBM 4.0 DOS
  8384.         Technical Reference, the MSDOS Encyclopedia or the MS 5.0 TR.
  8385.      7) For PC-MOS/386 4.x, the only error code is 08h (insufficient memory).
  8386.  
  8387.  
  8388. Function  68h   Commit File (DOS 3.3+)
  8389.                 Write all buffered data to disk
  8390. entry   AH      68h
  8391.         BX      file handle of previously opened file
  8392. return  CF      clear   successful
  8393.                 set     on error
  8394.                         AX      error code (unknown)
  8395. note 1) Faster and more secure method of closing a file in a network than
  8396.         current close commands.
  8397.      2) This is effectively the same as DUPing the handle for a file and then
  8398.         closing the new one, except that this call won't fail if the system
  8399.         is out of handles.
  8400.      3) The file's buffers are flushed and its directory and FAT entries are
  8401.         updated.
  8402.      4) The error value returned in AX is not documented in the IBM 4.0 DOS
  8403.         Technical Reference, the MSDOS Encyclopedia or the MS 5.0 TR.
  8404.      5) For PC-MOS/386 4.x, the error codes are 06h (invalid handle) and
  8405.         22h (wrong disk).
  8406.  
  8407.  
  8408. Function  69h   Disk Serial Number  DOS 4.0+ (US versions)
  8409.                 Handles "Volume Serial Number" on disks formatted with 4.0+
  8410. entry   AH      69h     Get Volume Serial Number
  8411.         AL      00h     get serial number
  8412.                 01h     set serial number
  8413.         BL      drive (0=default, 1=A, etc)
  8414.         DS:DX   pointer to disk information table
  8415. return  CF      set     on error
  8416.                 AX      error code
  8417.                 clear   if successful
  8418.                 AH      destroyed
  8419.                 AL      (fn 00h) buffer filled with appropriate values from
  8420.                                  extended BPB
  8421.                         (fn 01h) extended BPB on disk set to values from buffer
  8422.         DS:DX   disk information table. Format:
  8423.                 offset  size    description
  8424.                 00h     word    unknown (zeroes on my system)
  8425.                 02h    dword    disk serial number (binary)
  8426.                 06h 11 bytes    volume label or "NO NAME    " if none
  8427.                 11h  8 bytes    FAT type - string "FAT12   " or "FAT16   "
  8428. note 1) The FAT type field refers to the number of bits per directory entry.
  8429.      2) Does not generate a critical error; all errors are returned in AX.
  8430.      3) Error 0005h given if no extended BPB on disk.
  8431.      4) Does not work on network drives (error 0001h).
  8432.      5) Buffer after first two bytes is exact copy of bytes 27h thru 3Dh of
  8433.         extended BPB on disk.
  8434.  
  8435.  
  8436. Function  6Ah   Unknown  (DOS 4.0?)
  8437.  
  8438.  
  8439. Function  6Bh   Unknown  (DOS 4.0?)
  8440.  
  8441.  
  8442. Function  6Ch   Extended Open/Create  DOS 4.0+ (US)
  8443.                 Combines functions available with Open, Create, Create New,
  8444.                 and Commit File
  8445. entry   AH      6Ch
  8446.         AL      00h  reserved  [which means there might be other subfunctions?]
  8447.         BX      mode    format  0WF0 0000 ISSS 0AAA
  8448.                                 AAA is access code (read, write, read/write)
  8449.                                 SSS is sharing mode
  8450.                                 I       0       pass handle to child
  8451.                                         1       no inherit [interesting!]
  8452.                                 F       0       use int 24h for errors
  8453.                                         1       disable int 24h for all
  8454.                                                 I/O on this handle; use own
  8455.                                                 error routine
  8456.                                 W       0       no commit
  8457.                                         1       auto commit on all writes
  8458.         CX      create attribute
  8459.            bits 0       read only
  8460.                 1       hidden
  8461.                 2       system
  8462.                 3       volume label
  8463.                 4       reserved
  8464.                 5       archive
  8465.                 6-15    reserved
  8466.         DH      00h (reserved)
  8467.         DL      action if file exists/does not exists
  8468.            bits 0-3     action if file exists
  8469.                         0000    fail
  8470.                         0001    open
  8471.                         0010    replace/open
  8472.                 4-7     action if file does not exist
  8473.                         0000    fail
  8474.                         0001    create
  8475.         DS:SI   pointer to ASCIIZ file name
  8476. return  CF      set on error
  8477.                 AX      error code (unknown)
  8478.                 clear
  8479.                 AX      file handle
  8480.                 CX      action taken
  8481.                         01h     file opened
  8482.                         02h     file created/opened
  8483.                         03h     file replaced/opened
  8484. note    When APPEND is installed, if DX=xx1x it looks only in current
  8485.         directory, if DX=xx0x it will search the full append path. DX is
  8486.         called the open flag and gives what action to take if the file exits or
  8487.         does not exist.
  8488.  
  8489.  
  8490. Function  89h   undocumented - DOS_Sleep
  8491.  *              Not documented by Microsoft
  8492. entry   AH      89h
  8493. return  unknown
  8494. note 1) Function included in Microsoft C 4.0 startup code MSDOS.INC.
  8495.      2) Debugging shows that the first instruction on entry to DOS compares AH
  8496.         with 64h (at least in DOS 3.2) and aborts the call if AH > 64.
  8497.      3) Possibly used in European MSDOS 4.0?
  8498.  
  8499.  
  8500.  
  8501.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  8502.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  8503. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  8504.                      ISBN 1-878830-02-3 (disk-based text)
  8505.                     Copyright (c) 1987, 1992 Dave Williams
  8506.                         ┌─────────────────────────────┐
  8507.                         │ Shareware Version, 03/16/92 │
  8508.                         │  Please Register Your Copy  │
  8509.                         └─────────────────────────────┘
  8510.  
  8511.  
  8512.                             C H A P T E R   F I V E
  8513.  
  8514.                           Interrupts 22h Through 86h
  8515.  
  8516. note: the registered version of this chapter is more than twice this size.
  8517.  
  8518.  
  8519.  
  8520. ┌─────────────────────────────────────────────────────────────────────────────┐
  8521. │Interrupt 22h   Terminate Address ..................................... 5**1 │
  8522. └─────────────────────────────────────────────────────────────────────────────┘
  8523. (0:0088h)
  8524.  This interrupt transfers control to the far (dword) address at this interrupt
  8525. location when an application program terminates. The default address for this
  8526. interrupt is 0:0088h through 0:008Bh. This address is copied into the program's
  8527. Program Segment Prefix at bytes 0Ah through 0Dh at the time the segment is
  8528. created and is restored from the PSP when the program terminates. The calling
  8529. program is normally COMMAND.COM or an application. Do not issue this interrupt
  8530. directly, as the EXEC function call does this for you. If an application
  8531. spawns a child process, it must set the Terminate Address prior to issuing the
  8532. EXEC function call, otherwise when the second program terminated it would
  8533. return to the calling program's Terminate Address rather than its own. This
  8534. address may be set with int 21, function 25h.
  8535.  
  8536.  
  8537. ┌─────────────────────────────────────────────────────────────────────────────┐
  8538. │Interrupt 23h   Ctrl-Break Exit Address ............................... 5**2 │
  8539. └─────────────────────────────────────────────────────────────────────────────┘
  8540. (0:008Ch)
  8541.  If the user enters a Ctrl-Break during STDIN, STDOUT, STDPRN, or STDAUX, int
  8542. 23h is executed. If BREAK is on, int 23h is checked on MOST function calls
  8543. (notably 06h). If the user written Ctrl-Break routine saves all registers, it
  8544. may end with a return-from-interrupt instruction (IRET) to continue program
  8545. execution. If the user-written interrupt program returns with a long return, the
  8546. carry flag is used to determine whether the program will be aborted. If the
  8547. carry flag is set, the program is aborted, otherwise execution continues (as
  8548. with a return by IRET). If the user-written Ctrl-Break interrupt uses function
  8549. calls 09h or 0Ah, (Display String or Buffered Keyboard Input) then a three-byte
  8550. string of 03h-0Dh-0Ah (ETX/CR/LF) is sent to STDOUT. If execution is continued
  8551. with an IRET, I/O continues from the start of the line. When the interrupt
  8552. occurs, all registers are set to the value they had when the original function
  8553. call to DOS was made.
  8554.  
  8555.  There are no restrictions on what the Ctrl-Break handler is allowed to do,
  8556. including DOS function calls, as long as the registers are unchanged if an IRET
  8557. is used.
  8558.  
  8559.  If the program creates a new segment and loads a second program which itself
  8560. changes the Ctrl-Break address, the termination of the second program and
  8561. return to the first causes the Ctrl-Break address to be restored from the PSP
  8562. to the value it had before execution of the second program.
  8563.  
  8564. DOS can check for a Ctrl-C at a couple of different places.  In at least
  8565. some cases, the value in the AX register on entry to the int 23h handler
  8566. is the same as it was on the original entry to int 21h.
  8567.  
  8568. COMMAND.COM makes use of this fact in its int 23h handler.  When running
  8569. a batch file, if you press Ctrl-C it prompts you with the "Terminate batch
  8570. job (Y/N)?" question.  If you press Ctrl-C in response to that question,
  8571. the int 23h handler notices that it's being called recursively (having
  8572. set an internal flag), and uses the value of AX to determine how far it
  8573. had gotten on the previous pass.  If you have not responded to the query
  8574. yet, it asks it again; otherwise it just terminates the current program.
  8575.  
  8576. This could cause a problem in a program which was catching int 23h so that
  8577. it could release EMS or other resources  on exit, then pass it on to the
  8578. original handler.  When called a second time, it would correctly notice
  8579. that it had already cleaned up and wouldn't do it again, but by the time it
  8580. got to the original handler, AX would be trashed.  The result would be the
  8581. standard "Memory allocation error/Cannot load COMMAND, system halted".
  8582.  
  8583. Apparently, if you want to catch int 23h but also pass it on to the original
  8584. handler, you should either save and restore registers, or restore the original
  8585. vector on the first trap so you don't get invoked again.
  8586.  
  8587.  
  8588.  
  8589. ┌─────────────────────────────────────────────────────────────────────────────┐
  8590. │Interrupt 24h   Critical Error Handler ................................ 5**3 │
  8591. └─────────────────────────────────────────────────────────────────────────────┘
  8592. (0:0090h)
  8593.  
  8594.  When an unrecoverable I/O error occurs, control is transferred to an error
  8595. handler in the resident part of COMMAND.COM with an int 24h. This may be the
  8596. standard DOS error handler (Abort, Retry, Ignore, Fail?) or a user-written
  8597. routine.
  8598.  
  8599.  On entry to the error handler, AH will have its bit 7=0 (high order bit)
  8600. if the error was a disk error (probably the most common error), bit 7=1 if not.
  8601.  
  8602.  BP:SI contains the address of a Device Header Control Block from which
  8603. additional information can be retrieved (see below). The register is set up
  8604. for a retry operation and an error code is in the lower half of the DI register
  8605. with the upper half undefined.
  8606.  
  8607.  DOS places the following items on the user stack. The stack contains the
  8608. following from top to bottom:
  8609.  
  8610.         IP   │   DOS registers from the issuing int 24h
  8611.         CS   │
  8612.       flags  │
  8613.       ───────┼───────────────────────────────────────────────────────
  8614.         AX   │   user registers at time of original int 21h request
  8615.         BX   │
  8616.         CX   │
  8617.         SI   │
  8618.         DI   │
  8619.         BP   │
  8620.         DS   │
  8621.         ES   │
  8622.       ───────┼───────────────────────────────────────────────────────
  8623.         IP   │   original int 21h from the user to DOS
  8624.         CS   │
  8625.       flags  │
  8626.  
  8627.  To reroute the critical error handler to a user-written critical error handler,
  8628. the following should be done:
  8629.  
  8630. Before an int 24h occurs:
  8631. 1) The user application initialization code should save the int 24h vector and
  8632.    replace the vector with one pointing to the user error routine.
  8633.  
  8634. When the int 24h occurs:
  8635. 2) When the user error routine received control it should push the flag
  8636.    registers onto the stack and execute a far call to the original int 24h
  8637.    vector saved in step 1.
  8638. 3) DOS gives the appropriate prompt, and waits for user input (Abort, Retry,
  8639.    Ignore, Fail). After the user input, DOS returns control to the user error
  8640.    routine instruction following the far call.
  8641. 4) The user error routine can now do any tasks necessary. To return to the
  8642.    original application at the point the error occurred, the error routine needs
  8643.    to execute an IRET instruction. Otherwise, the user error routine should
  8644.    remove the IP, CS, and flag registers from the stack. Control can then be
  8645.    passed to the desired routine.
  8646.  
  8647.  Int 24h provides the following values in registers on entry to the interrupt
  8648. handler:
  8649.  
  8650. entry   AH      status byte (bits)
  8651.                 7       0       disk I/O hard error
  8652.                         1       other error - if block device, bad FAT
  8653.                                 - if char device, code in DI
  8654.                 6       unused
  8655.                 5       0       if IGNORE is not allowed
  8656.                         1       if IGNORE is allowed
  8657.                 4       0       if RETRY  is not allowed
  8658.                         1       if RETRY  is allowed
  8659.                 3       0       if FAIL   is not allowed
  8660.                         1       if FAIL   is allowed
  8661.                 2 \     disk area of error  00 = DOS area  01 = FAT
  8662.                 1 /                         10 = root dir  11 = data area
  8663.                 0       0       if read operation
  8664.                         1       if write operation
  8665.         AL      drive number if AH bit 7 = 1, otherwise undefined
  8666.                 If it is a hard error on disk (AH bit 7=0), register AL
  8667.                 contains the failing drive number (0=A:, 1=B:, etc.).
  8668.         BP:SI   address of a Device Header Control Block for which error
  8669.                 occurred. Block device if high bit of BP:SI+4 = 1
  8670.         DI      (low byte) error code (note: high byte is undefined)
  8671.                error code                 description
  8672.                 00h             attempt to write on write-protected diskette
  8673.                 01h             unknown unit
  8674.                 02h             drive not ready
  8675.                 03h             unknown command
  8676.                 04h             data error (bad CRC)
  8677.                 05h             bad request structure length
  8678.                 06h             seek error
  8679.                 07h             unknown media type
  8680.                 08h             sector not found
  8681.                 09h             printer out of paper
  8682.                 0Ah             write fault
  8683.                 0Bh             read fault
  8684.                 0Ch             general failure
  8685.                 0Fh             invalid disk change      (DOS 3.0+)
  8686.                 10h             FCB unavailable          (DOS 3.0+)
  8687.                 11h             sharing buffer overflow  (DOS 3.0+)
  8688.  
  8689.         note: Only codes 00h through 0Ch are defined in DR-DOS 3.32.
  8690.  
  8691. The handler must return this information:
  8692.  
  8693.  The registers are set such that if an IRET is executed, DOS responds according
  8694. to (AL) as follows:
  8695. AL      00h     IGNORE the error
  8696.         01h     RETRY the operation
  8697.         02h     ABORT via int 22h (jump to terminate address)
  8698.         03h     FAIL the system call that is in progress (DOS 3.0+)
  8699. note 1) Be careful when choosing to ignore a response because this causes DOS
  8700.         to think that an operation has completed successfully when it may not
  8701.         have.
  8702.      2) If the error was a character device, the contents of AL are invalid.
  8703.      3) Early PS/2 BIOSes did not perform a retry on disk errors until a disk
  8704.         had been read at least once after boot-up.
  8705.  
  8706.  
  8707. Other Errors
  8708.  
  8709.  If AH bit 7=1, the error occurred on a character device, or was the result of
  8710. a bad memory image of the FAT. The device header passed in BP:SI can be examined
  8711. to determine which case exists. If the attribute byte high-order bit indicates
  8712. a block device, then the error was a bad FAT. Otherwise, the error is on a
  8713. character device.
  8714.  
  8715.  If a character device is involved, the contents of AL are unpredictable, and
  8716. the error code is in DI as above.
  8717.  
  8718. note 1) Before giving this routine control for disk errors, DOS performs several
  8719.         retries. The number of retries varies according to the DOS version.
  8720.      2) For disk errors, this exit is taken only for errors occurring during an
  8721.         int 21h function call. It is not used for errors during an int 25h or
  8722.         26h.
  8723.      3) This routine is entered in a disabled state.
  8724.      4) All registers must be preserved.
  8725.      5) This interrupt handler should refrain from using DOS function calls. If
  8726.         necessary, it may use calls 01h through 12h. Use of any other call
  8727.         destroys the DOS stack and leaves DOS in an unpredictable state.
  8728.      6) The interrupt handler must not change the contents of the device header.
  8729.      7) If the interrupt handler handles errors itself rather than returning to
  8730.         DOS, it should restore the application program's registers from the
  8731.         stack, remove all but the last three words on the stack, then issue an
  8732.         IRET. This will return to the program immediately after the int 21h
  8733.         that experienced the error. Note that if this is done DOS will be in an
  8734.         unstable state until a function call higher than 12h is issued,
  8735.         therefore not recommended.
  8736.      8) For DOS 3.x+, IGNORE requests (AL=0) are converted to FAIL for critical
  8737.         errors that occur on FAT or DIR sectors.
  8738.      9) For DOS 3.10 up, IGNORE requests (AL=0) are converted to FAIL requests
  8739.         for network critical errors (50-79).
  8740.     10) The device header pointed to by BP:SI is as follows:
  8741.        dword    pointer to next device (0FFFFh if last device)
  8742.         word    attributes:
  8743.                 bit     15      1       if character device.
  8744.                                         If bit 15 is 1:
  8745.                                         bit 0 = 1 if current standard input
  8746.                                         bit 1 = 1 if current standard output
  8747.                                         bit 2 = 1 if current NULL device
  8748.                                         bit 3 = 1 if current CLOCK device
  8749.                                 0       if block device.
  8750.                 bit     14      is the IOCTL bit
  8751.         word    pointer to device driver strategy entry point
  8752.         word    pointer to device driver interrupt entry point
  8753.       8 bytes   character device named field for block devices. The first byte
  8754.                 is the number of units.
  8755.     11) To tell if the error occurred on a block or character device, look at
  8756.         bit 15 in the attribute field (WORD at BP:SI+4).
  8757.     12) If the name of the character device is desired, look at the eight bytes
  8758.         starting at BP:SI+10.
  8759.  
  8760.  
  8761. Handling of Invalid Responses (DOS 3.0+)
  8762.  
  8763.      A) If IGNORE (AL=0) is specified by the user and IGNORE is not allowed
  8764.         (bit 5=0), make the response FAIL (AL=3).
  8765.      B) If RETRY (AL=1) is specified by the user and RETRY is not allowed
  8766.         (bit 4=0), make the response FAIL (AL=3).
  8767.      C) If FAIL (AL=3) is specified by the user and FAIL is not allowed
  8768.         (bit 3=0), make the response ABORT. (AL=2)
  8769.  
  8770.  
  8771.  
  8772.  
  8773. ┌─────────────────────────────────────────────────────────────────────────────┐
  8774. │Interrupt 25h   Absolute Disk Read .................................... 5**4 │
  8775. │Interrupt 26h   Absolute Disk Write ................................... 5**5 │
  8776. └─────────────────────────────────────────────────────────────────────────────┘
  8777. (0:0094h, 0:0098h)
  8778.  
  8779.   These transfer control directly to the disk device driver. On return, the
  8780. original flags are still on the stack (put there by the INT instruction). This
  8781. is necessary because return information is passed back in the current flags.
  8782. All registers except the segment registers are destroyed by these calls.
  8783.  
  8784.   These interrupts should be avoided for software that is intended to run on
  8785. a network, as they may cause troubles in network environments.
  8786.  
  8787.   PC-MOS/386 provides these services only for compatibility with existing
  8788. DOS-mode apps.  25h/26h are not available for native mode 386-mode DOS apps.
  8789.  
  8790.   The number of sectors specified is transferred between the given drive and the
  8791. transfer address. Logical sector numbers are obtained by numbering each sector
  8792. sequentially starting from track 0, head 0, sector 1 (logical sector 0) and
  8793. continuing along the same head, then to the next head until the last sector on
  8794. the last head of the track is counted.  Thus, logical sector 1 is track 0, head
  8795. 0, sector 2; logical sector 2 is track 0, head 0, sector 3; and so on. Numbering
  8796. then continues wih sector 1 on head 0 of the next track. Note that although the
  8797. sectors are sequentially numbered (for example, sectors 2 and 3 on track 0 in
  8798. the example above), they may not be physically adjacent on disk, due to
  8799. interleaving. Note that the mapping is different from that used by DOS 1.10 for
  8800. double-sided diskettes.
  8801.  
  8802.  The request is as follows:
  8803.  
  8804. int 25h for Absolute Disk Read,            | except Compaq DOS 3.31 or DOS 4.0+
  8805. int 26h for Absolute Disk Write            | over-32Mb partitions
  8806. entry   AL      drive number (0=A:, 1=B:, etc)
  8807.         CX      number of sectors to read (int 25h) or write (int 26h)
  8808.         DS:BX   segment/offset of disk transfer address buffer (DTA)
  8809.         DX      first relative sector to read - beginning logical sector number
  8810. return  CF      set if error
  8811.         AL      error code issued to int 24h in low half of DI
  8812.         AH      01h     bad command
  8813.                 02h     bad address mark
  8814.                 03h     write-protected disk
  8815.                 04h     requested sector not found
  8816.                 08h     DMA failure
  8817.                 10h     data error (bad CRC)
  8818.                 20h     controller failed
  8819.                 40h     seek operation failed
  8820.                 80h     attachment failed to respond
  8821. note 1) DOS returns with a far ret which leave the original flags on the stack.
  8822.         Be sure to pop the stack to prevent uncontrolled growth.
  8823.      2) MSC 3.0's int86() was a straight interrupt call.  MSC 4.0 and later
  8824.         make special provision for adjusting the stack on int 25h and 26h.
  8825.         This probably won't hurt anything but you should be aware of it.
  8826.      3) Ints 25h and 26h will try rereading a disk if they get an error the
  8827.         first time.
  8828.  
  8829.  To address partition sizes greater than 32Mb an extended format is provided
  8830. in Compaq DOS 3.31, DOS 4.0, and DR-DOS. This format passes a 32-bit address
  8831. value by means of a parameter block. The extended format may be used to
  8832. address disks smaller than 32Mb as well as larger.
  8833.  
  8834.  The request is as follows:
  8835.  
  8836. int 25h for Absolute Disk Read,            | Compaq DOS 3.31 or DOS 4.0+
  8837. int 26h for Absolute Disk Write            | over-32Mb partitions
  8838. entry   AL      drive number (0=A:, 1=B:, etc)
  8839.         CX      0FFFFh
  8840.         DS:BX   address of parameter block. Block format:
  8841.               4 bytes    sector number
  8842.               2 bytes    number of sectors to read
  8843.               4 bytes    FAR pointer to buffer
  8844. return  CF      set if error
  8845.         AL      error code issued to int 24h in low half of DI
  8846.         AH      01h     bad command
  8847.                 02h     bad address mark
  8848.                 03h     write-protected disk
  8849.                 04h     requested sector not found
  8850.                 08h     DMA failure
  8851.                 10h     data error (bad CRC)
  8852.                 20h     controller failed
  8853.                 40h     seek operation failed
  8854.                 80h     attachment failed to respond
  8855. note 1) DOS returns with a far ret which leave the original flags on the stack.
  8856.         Be sure to pop the stack to prevent uncontrolled growth.
  8857.      2) MSC 3.0's int86() was a straight interrupt call.  MSC 4.0 and later
  8858.         make special provision for adjusting the stack on int 25h and 26h.
  8859.         This probably won't hurt anything but you should be aware of it.
  8860.      3) Ints 25h and 26h will try rereading a disk if they get an error the
  8861.         first time.
  8862.      4) Partition is potentially >32M (and requires this form of the call) if
  8863.         bit 1 of device attribute word in device driver is set.
  8864.      5) In the IBM OS/2 Tech Ref Volume 1, page 7-33, under "DOS Environment
  8865.         Software Interrupt Support", it lists:
  8866.         25h  direct read       supported
  8867.         26h  direct write      an error is returned on requests for
  8868.                                non-removable media
  8869.  
  8870.   Interrupts 25h and 26h can read logical sectors only.  They cannot read
  8871. hidden sectors.
  8872.  
  8873.   Critical errors are not processed by ints 25h and 26h.  Should one happen,
  8874. the  interrupt routine will return an error value to the program but will not 
  8875. itself call the critical error handler at int 24h.
  8876.   
  8877.  The Microsoft DOS 5.0 Technical Reference refers to this call as "superceded" 
  8878. and directs you to int 21h, fn 440Dh, minor code 61h, "Read Track on Logical 
  8879. Drive" and minor code 41h, "Write Track on Logical Drive."  See Chapter 4.
  8880.  
  8881.  
  8882. ┌─────────────────────────────────────────────────────────────────────────────┐
  8883. │Interrupt 27h   Terminate And Stay Resident ........................... 5**6 │
  8884. └─────────────────────────────────────────────────────────────────────────────┘
  8885. (0:009Ch)       (obsolete)
  8886.  This vector is used by programs that are to remain resident when COMMAND.COM
  8887. regains control.
  8888.  
  8889.  After initializing itself, the program must set DX to its last address plus
  8890. one relative to the program's initial DS or ES value (the offset at which other
  8891. programs can be loaded), then execute interrupt 27h. DOS then considers the
  8892. program as an extension of itself, so the program is not overlaid when other
  8893. programs are executed. This is useful for loading programs such as utilities
  8894. and interrupt handlers that must remain resident.
  8895.  
  8896. entry   CS      current program segment
  8897.         DX      last program byte + 1
  8898. return  none
  8899. note 1) This interrupt must not be used by .EXE programs that are loaded into
  8900.         the high end of memory.
  8901.      2) This interrupt restores the interrupt 22h, 23h, and 24h vectors in the
  8902.         same manner as interrupt 20h. Therefore, it cannot be used to install
  8903.         permanently resident Ctrl-Break or critical error handler routines.
  8904.      3) The maximum size of memory that can be made resident by this method is
  8905.         64K.
  8906.      4) Memory can be more efficiently used if the block containing a copy of
  8907.         the environment is deallocated before terminating. This can be done by
  8908.         loading ES with the segment contained in 2Ch of the PSP, and issuing
  8909.         function call 49h (Free Allocated Memory).
  8910.      5) DOS function call 4Ch allows a program to pass a completion code to DOS,
  8911.         which can be interpreted with processing (see function call 31h).
  8912.      6) If int 27h is called by a program linked with the /HIGH switch, it
  8913.         will occupy the top of memory and prevent COMMAND.COM from reloading,
  8914.         which is probably not what you want.
  8915.      7) Int 21, function 31h is the preferred method to cause a program to
  8916.         remain resident because this allows return information to be passed and
  8917.         allows a program larger than 64K to remain resident.
  8918.      8) It is possible to make an EXE program resident with this call by
  8919.         putting a 27h in the second byte of the PSP and terminating with a
  8920.         RET FAR.
  8921.      9) Programs terminating with int 27h do not close files on exit. Your
  8922.         program must explicitly close any opened files before going resident.
  8923.     10) Int 27h does not work correctly when DX contains values from 0FFF1h to
  8924.         0FFFFh. In this case, DOS discards the high bit of the contents of DX,
  8925.         resulting in 32k less resident memory than was requested by the
  8926.         program.
  8927.     11) This interrupt will work with PC-MOS/386, but there are a number of
  8928.         MOS-specific advantages to using int 21h/31h instead.  See Chapter
  8929.         4 for further explanation.
  8930.  
  8931.  
  8932. ┌─────────────────────────────────────────────────────────────────────────────┐
  8933. │Interrupt 28h   (not documented by Microsoft) ......................... 5**7 │
  8934. └─────────────────────────────────────────────────────────────────────────────┘
  8935.            *    DOS Idle Interrupt
  8936.  
  8937.  Int 28h has been provided by DOS since release 2.0. The int 28h process is
  8938. similar to the "Timer Tick" process provided by BIOS via int 1Ch in that it is
  8939. an "outbound" (from DOS) call which an application can "hook onto" to get
  8940. service at a particular entry point. DOS normally only issues int 28h when it
  8941. recieves a function call (int 21h) from a foreground application with an
  8942. argument in the range of 0 thru 12 (0Ch) in the AH register, or when it is
  8943. idling waiting for keyboard input. In effect, when DOS issues int 28h, it is
  8944. saying to the background task "I'm not doing anything hot right now, if you can
  8945. use the time, go ahead." This means that a foreground application which doesn't
  8946. do many low-number DOS functions can preempt CPU time easily.
  8947.  
  8948.  When int 28h is being issued it is usually safe to do DOS calls. You won't get
  8949. int 28hs if a program is running that doesn't do its keyboard input through
  8950. DOS. You should rely on the timer interrupt for these. It is used primarily by
  8951. the PRINT.COM routines, but any number of other routines can be chained to it
  8952. by saving the original vector and calling it with a FAR call (or just JMPing to
  8953. it) at the end of the new routine.
  8954.  
  8955.  Int 28h is not called at all when any non-trivial foreground task is running.
  8956. As soon as a foreground program has a file open, int 28h no longer gets called.
  8957. Could make a good driver for for a background program that works as long as
  8958. there is nothing else going on in the machine.
  8959.  
  8960.  DOS uses 3 separate internal stacks: one for calls 01h through 0Ch; another
  8961. for calls 0Dh and above; and a third for calls 01h through 0Ch when a Critical
  8962. Error is in progress. When int 28h is called, any calls above 0Ch can be
  8963. executed without destroying the internal stack used by DOS at the time.
  8964.  
  8965.  The byte which is pushed on the stack before an int 28h just indicates which
  8966. stack area is being used by the current int 21h call. In DOS 3.1, the code
  8967. sequence that calls int 28h looks like this:
  8968.  
  8969.         PUSH    SS:[0304]
  8970.         INT     28
  8971.         POP     SS:[0304]
  8972.  
  8973.  The low-order byte of the word pushed contains 1 if the int 21h call currently
  8974. in progress is for services 1 through 0Ch, and 0 for service 0 and for 0Dh and
  8975. up. Assuming that the last DOS call was not a reentrant one, this tells you
  8976. which set of DOS services should be safe to call.
  8977.  
  8978. entry   no parameters available
  8979. return  none
  8980. note 1) The int 28h handler may invoke any int 21h function except functions
  8981.         00h through 0Ch (and 50h/51h under DOS 2.x unless DOS CritErr flag is
  8982.         set).
  8983.      2) Apparently int 28h is also called during screen writes.
  8984.      3) Until some program installs its own routine, this interrupt vector
  8985.         simply points to an IRET opcode.
  8986.      4) Supported in OS/2 1.0's DOS Compatibility Box.
  8987.      5) It is possible, if you are careful, to enhance the background priority
  8988.         by providing more int 28h calls than DOS normally would issue.
  8989.      6) If the InDOS flag is zero on int 28h, then it was called by someone
  8990.         other than DOS, and the word on the stack should NOT be examined.
  8991.      7) From Quarterdeck Tech Support: "Turbo Pascal 4.0 uses int 28h as a
  8992.         convenience for its SideKick product users. Interrupt 28 is the DOS
  8993.         busy flag which DESQview treats as a pause and gives up time...
  8994.         foreground gets little time and background gets a lot...reverse of
  8995.         normal."
  8996.      8) This interrupt is supported by PC-MOS/386 and MS Windows 3.0+.
  8997.  
  8998.  
  8999. ┌─────────────────────────────────────────────────────────────────────────────┐
  9000. │Interrupt 29h   (not documented by Microsoft) ......................... 5**8 │
  9001. └─────────────────────────────────────────────────────────────────────────────┘
  9002.            *    Internal - Quick Screen Output
  9003.  
  9004.  This method is extremely fast (much faster than DOS 21h subfunctions 2 and 9,
  9005. for example), and it is portable, even to "non-compatible" MS-DOS computers.
  9006.  
  9007. entry   AL      ASCII value for character to output to screen
  9008. return  unknown
  9009. note 1) Documented by Digital Equipment's DOS Reference as provided with the
  9010.         DEC Rainbow. Also documented by Digital Research in the DR-DOS manual.
  9011.      2) If ANSI.SYS is installed, character output is filtered through it.
  9012.      3) Works on the IBM PC and compatibles, Wang PC, HP-150 and Vectra, DEC
  9013.         Rainbow, NEC APC, Texas Instruments PC and others.
  9014.      4) This interrupt is called from the DOS's output routines if output is
  9015.         going to a device rather than a file, and the device driver's attribute
  9016.         word has bit 3 (04h) set to "1".
  9017.      5) This call has been tested with MSDOS 2.11, PCDOS 2.1, PCDOS 3.1, PCDOS
  9018.         3.2, PCDOS 3.3, PCDOS 4.01, and Compaq DOS 3.31.
  9019.      6) Used in IBMBIO.COM as a vector to int 10, function 0Eh (write TTY)
  9020.         followed by an IRET.
  9021.      7) Most of the fast ANSI device drivers use this interrupt - ZANSI.SYS,
  9022.         NANSI.SYS, and PCMag's ANSI.COM, Quarterdeck's DVANSI.SYS.
  9023.      8) When using int 29h to output characters the ASCII 7 (BELL) will
  9024.         suppress character output while the bell is sounding.
  9025.      9) When device drivers (or the SYSINIT module which loads the drivers)
  9026.         need to do console output, they use int 29h, to call the console device
  9027.         driver directly. For example, messages telling you about errors in your
  9028.         CONFIG.SYS file are printed using this service.
  9029.  
  9030.  
  9031.  
  9032. ┌─────────────────────────────────────────────────────────────────────────────┐
  9033. │Interrupt 2Ah   Microsoft Networks - Session Layer Interrupt .......... 5**9 │
  9034. └─────────────────────────────────────────────────────────────────────────────┘
  9035.         1)  This interrupt was not officially documented by Microsoft
  9036.             until the release of Windows 3.0, which has setup parameters
  9037.             for int 2Ah.
  9038.         2)  LANtastic NetBIOS interface, original IBM PC LAN interface.
  9039.         3)  NetBIOS alternate interface. The alternate interface (2Ah) was
  9040.             originally designed as a "higher" level interface to network
  9041.             communications rather than the "low" level interface (5Ch)
  9042.             provided by the NETBIOS. The 2Ah interface, however, does not
  9043.             support any higher level functions than does the 5Ch interface
  9044.             and therefore has not become a de facto standard as has the 5Ch
  9045.             interface.
  9046.         4)  Most DOS 4.0 external programs (SHARE, etc) check this
  9047.             interrupt during installation.
  9048.  
  9049. entry   AH      00h     Check for Int 2Ah Network BIOS Installation
  9050.                         return  AH      nonzero if installed
  9051.                 01h     Execute NETBIOS Request (no error retry)
  9052.                         ES:BX   pointer to NCB
  9053. return          AL      NETBIOS error code
  9054.                 AH      00h     if no error
  9055.                         01h     if error
  9056.                 02h     Set Net Printer Mode
  9057.                 03h     Get Shared-Device Direct I/O Status
  9058.                         AL      00h
  9059.                         DS:SI   pointer to ASCIIZ disk device name
  9060.                         return  CF      clear   if allowed
  9061.                                         set     if denied
  9062.                         note 1) Direct I/O is through ints 13h, 25h, or 26h.
  9063.                              2) If the device is redirected (see int 21h/5F02h)
  9064.                                 or this call returns with carry set, the program
  9065.                                 should not perform direct disk I/O.
  9066.                              3) The device pointed to by DS:SI must include the
  9067.                                 colon in the drive:pathname.
  9068.                              4) It may take some time for this call to return
  9069.                                 to the calling program. Do not use in time-
  9070.                                 sensitive applications.
  9071.                 04h     Execute NETBIOS
  9072.                         AL      00h     retry on error
  9073.                                 01h     no retry on error
  9074.                         ES:BX   pointer to network control block
  9075.                         return  AX      0000h   for no error
  9076.                                 AH      01h     if error
  9077.                                         AL      error code (unknown)
  9078.                         note 1) IBM PC LAN says, "for adapter independence,
  9079.                                 use int 2Ah. No not use 5Ch function provided
  9080.                                 by the network adapter."
  9081.                              2) Error codes that are automatically retried are:
  9082.                                 09h     no session resources available
  9083.                                 12h     session open rejected
  9084.                                 21h     interface busy
  9085.                 05h     Get Network Resource Information
  9086.                         AL      00h
  9087.                         return  AX      reserved
  9088.                                 BX      # of network names (16 - names in use)
  9089.                                 CX      number of available NCB commands
  9090.                                 DX      number of sessions (max - pending)
  9091.                 06h     Network Print-Stream Control
  9092.                 (IBM PC LAN)
  9093.                         AL      01h     Set spooled output to concatenation mode
  9094.                                 02h     Set spooled output to truncation mode
  9095.                                 03h     Trunate printer stream
  9096.                         return  CF      clear   no error
  9097.                                         set     AX      DOS error code
  9098.                 (LANtastic)
  9099.                         AL      01h     Set spooled output to combined mode
  9100.                                 return  none
  9101.                                 02h     Set spooled output in separate mode
  9102.                                 return  none
  9103.                                 note    Printer output is not combined when
  9104.                                         multiple programs are run or when the
  9105.                                         printer is opened or closed. This cmd.
  9106.                                         implicitly starts a new print job.
  9107.                                 03h     Flush printer output
  9108.                                 return  none
  9109.                                 note 1) Printer output is flushed and a new
  9110.                                         print job is started. If no output
  9111.                                         exists to be flushed then this function
  9112.                                         has no affect.
  9113.                                      2) 03h is equivalent to Ctrl/Alt/keypad-*
  9114.                         note    NETBIOS 1.10
  9115.                 07h-19h unknown
  9116.                 20h     unknown
  9117.                         note    AL=01h intercepted by DESQview 2.0.
  9118.                 23h     Receive Broadcast Datagram
  9119.                         IBM PC LAN 1.2. Manual says "use is not allowed".
  9120.                 80h     Begin DOS Critical Section
  9121.                         AL      critical section number (1 to 6)
  9122.                 note    SHARE.EXE uses critical section number 01h.
  9123.                 81h     End DOS Critical Section
  9124.                         AL      critical section number (1 to 6)
  9125.                 note    SHARE.EXE uses critical section number 01h.
  9126.                 82h     Server Hook
  9127.                         stack   AX from call to int 21h
  9128.                         return  stack unchanged
  9129.                         note    Called by the int 21h function dispatcher
  9130.                                 in DOS 3.10+ for function 0 and functions
  9131.                                 greater than 0Ch except 59h.
  9132.                 84h     Keyboard Busy Loop
  9133.                         note    Same functionality as DOS's int 28h?
  9134.                 87h     Used by DOS PRINT to mark Critical Regions:
  9135.                         AL      00h     Begin Critical Region
  9136.                                 01h     End Critical Region
  9137.                         return  CF      set     region already active
  9138.                0A3h     Receive Broadcast Datagram
  9139.                         IBM PC LAN 1.2. Manual says "use is not allowed".
  9140.  
  9141.  
  9142. ┌─────────────────────────────────────────────────────────────────────────────┐
  9143. │Interrupt 2Bh   (not documented by Microsoft) ......................... 5**10│
  9144. └─────────────────────────────────────────────────────────────────────────────┘
  9145.            *    Unknown - Internal Routine for DOS (IRET)
  9146.  
  9147.  
  9148. ┌─────────────────────────────────────────────────────────────────────────────┐
  9149. │Interrupt 2Ch   (not documented by Microsoft) ......................... 5**11│
  9150. └─────────────────────────────────────────────────────────────────────────────┘
  9151.            *    Unknown - Internal Routine for DOS (IRET)
  9152.  
  9153.  
  9154. ┌─────────────────────────────────────────────────────────────────────────────┐
  9155. │Interrupt 2Dh   (not documented by Microsoft) ......................... 5**12│
  9156. └─────────────────────────────────────────────────────────────────────────────┘
  9157.            *    Unknown - Internal Routine for DOS (IRET)
  9158.  
  9159.  
  9160. ┌─────────────────────────────────────────────────────────────────────────────┐
  9161. │Interrupt 2Eh   (undocumented by Microsoft)  (DOS 2.0+) ............... 5**13│
  9162. └─────────────────────────────────────────────────────────────────────────────┘
  9163.            *    Internal Routine for DOS  (Alternate EXEC)
  9164.  
  9165.   This interrupt passes a command line addressed by DS:SI to COMMAND.COM. The
  9166. command line must be formatted just like the unformatted parameter area of a
  9167. Program Segment Prefix. That is, the first byte must be a count of characters,
  9168. and the second and subsequent bytes must be a command line with parameters,
  9169. terminated by a carriage return character.
  9170.  
  9171.   When executed, int 2Eh will reload the transient part of the command
  9172. interpreter if it is not currently in memory. If called from a program that
  9173. was called from a batch file, it will abort the batch file. If executed from a
  9174. program which has been spawned by the EXEC function, it will abort the whole
  9175. chain and probably lock up the computer. Int 2Eh also destroys all registers
  9176. including the stack pointer.
  9177.  
  9178.   Int 2Eh is called from the transient portion of the program to reset the DOS
  9179. PSP pointers using the above Functions #81 & #80, and then reenters the
  9180. resident program.
  9181.  
  9182.   When called with a valid command line, the command will be carried out by
  9183. COMMAND.COM just as though you had typed it in at the DOS prompt. Note that the
  9184. count does not include the carriage return. This is an elegant way to perform a
  9185. SET from an application program against the master environment block for
  9186. example.
  9187.  
  9188. entry   DS:SI   pointer to an ASCIIZ command line in the form:
  9189.                         count byte
  9190.                         ASCII string
  9191.                         carriage return
  9192.                         null byte
  9193. note 1) Destroys all registers including stack pointer.
  9194.      2) Seems to work OK in both DOS 2.x and 3.x.
  9195.      3) It is reportedly not used by DOS.
  9196.      4) As far as known, int 2Eh is not used by DOS 3.1, although it was called
  9197.         by COMMAND.COM of PCDOS 3.0, so it appears to be in 3.1 only for the
  9198.         sake of compatibility.
  9199.      5) Not used by the aftermarket 4DOS command interpreter prior to version
  9200.         3.0. 3.0 merely hooks this vector and does nothing with it.  3.02 and
  9201.         later provide a TSR to add 2Eh capability.
  9202.      6) Trapped by PC-MOS/386 to prevent illegal entry into the command
  9203.         processor.
  9204.  
  9205.  
  9206.  
  9207. ┌─────────────────────────────────────────────────────────────────────────────┐
  9208. │Interrupt 2Fh   Multiplex Interrupt ................................... 5**14│
  9209. └─────────────────────────────────────────────────────────────────────────────┘
  9210.  
  9211.  Interrupt 2Fh is the multiplex interrupt. A general interface is defined
  9212. between two processes. It is up to the specific application using interrupt
  9213. 2Fh to define specific functions and parameters.
  9214.  
  9215.  This interrupt is becoming more commonly used as the available interrupt 21
  9216. functions are getting to be in short supply. Int 2Fh doesn't require any
  9217. support from DOS itself for it to be used in application programs. It's not
  9218. handled by DOS, but by the programs themselves.
  9219.  
  9220.  Every multiplex interrupt handler is assigned a specific multiplex number.
  9221. The multiplex number is specified in the AH register; the AH value tells which
  9222. program your request is directed toward. The specific function that the handler
  9223. is to perform is placed in the AL register. Other parameters are places in the
  9224. other registers as needed. The handlers are chained into the 2Fh interrupt
  9225. vector and the multiplex number is checked to see if any other application is
  9226. using the same multiplex number. There is no predefined method for assigning a
  9227. multiplex number to a handler. You must just pick one. To avoid a conflict if
  9228. two applications choose the same multiplex number, the multiplex numbers used by
  9229. an application should be patchable. In order to check for a previous
  9230. installation of the current application, you can search memory for a unique
  9231. string included in your program. If the value you wanted in AH is taken but
  9232. you don't find the string, then another application has grabbed that location.
  9233.  
  9234.  Int 2Fh was not documented under DOS 2.x. There is no reason not to use int 2Fh
  9235. as the multiplex interrupt in DOS 2.x. The only problem is that DOS 2.x does not
  9236. initialize the int 2Fh vector, so when you try to chain to it like you are
  9237. supposed to, it will crash. If your program checks the vector for being zero
  9238. and initializes it itself or doesn't chain in that case, it will work for you
  9239. n 2.x just the same as 3.x.
  9240.  
  9241.  DOS 3.2 itself contains some int 2Fh handlers - it uses values of 08h, 13h,
  9242. and 0F8h. There may be more. NLSFUNC from DOS 3.3 up uses part of int 2Fh and
  9243. so does GRAFTABL.
  9244.  
  9245.  For int 2Fh calls, register AH identifies which program is to handle the
  9246. interrupt. AH values 00h-7Fh are reserved for DOS, not that anyone cares much.
  9247. Values 0C0h-0FFh are reserved for applications. Register AL contains the
  9248. subfunction code if used.
  9249.  
  9250.  IBM has reported that PC-DOS 4.0 will sometimes hang when substituting int
  9251. 2Fh for int 67h for network calls. Most of DOS 4.0's external commands check
  9252. the 2Fh PRINT and other statuses while operating for enhanced network support.
  9253. DOS 4.0 SHARE.EXE traps the 2Fh interrupt. IBM and Microsoft DOS programming
  9254. information for versions prior to 4.0 strongly imply that 2Fh functions not
  9255. used by PRINT.COM are open for general use. DOS 4.0 uses quite a few 2Fh
  9256. functions and this may be a cause of incompatibility with some software.
  9257.  
  9258.  LANtastic NOS SERVER.EXE v2.49s and earlier will not run under DOS 4.x due
  9259. to int 2Fh conflicts. This conflict also occurs under DR-DOS versions 3.40 and
  9260. 3.41. DR-DOS is internally similar to DOS 4.0.
  9261.  
  9262.  
  9263. Function   01h  PRINT.COM
  9264.            PC-DOS 3.3's PRINT.COM hooks the following interrupt vectors:
  9265.                 05h     PrintScreen Interrupt
  9266.                 13h     BIOS Disk Interrupt
  9267.                 14h     BIOS Serial Communications Interrupt
  9268.                 15h     BIOS "System Services" Interrupt
  9269.                 17h     BIOS Printer Interrupt
  9270.                 19h     Bootstrap Loader Interrupt
  9271.                 1Ch     Timer Tick
  9272.                 23h     Control-C Terminate Address
  9273.                 24h     Critical Error Handler Address
  9274.                 28h     DOS Idle Interrupt (undocumented)
  9275.                 2Fh     Multiplex Interrupt
  9276.  
  9277. entry   AH      01h
  9278.                 AL      00h     PRINT  Get Installed State
  9279.                         This call must be defined by all int 2Fh handlers. It
  9280.                         is used by the caller of the handler to determine if
  9281.                         the handler is present. On entry, AL=0. On return, AL
  9282.                         contains the installed state as follows:
  9283.                 return  AL      0FFh    installed
  9284.                                 01h     not installed, not OK to install
  9285.                                 00h     not installed, OK to install
  9286.  
  9287.                         01h     PRINT  Submit File
  9288.                         DS:DX   pointer to submit packet
  9289.                                 format  byte    level
  9290.                                         dword   pointer to ASCIIZ filename
  9291.                 return  CF      set if error
  9292.                                 AX      error code
  9293.                 note 1) A submit packet contains the level (BYTE) and a pointer
  9294.                         to the ASCIIZ string (DWORD in offset:segment form).
  9295.                         The ASCIIZ string must contain the drive, path, and
  9296.                         filename of the file you want to print. The filename
  9297.                         cannot contain global filename characters.
  9298.                 return  CF      set if error
  9299.                                 AX      error code
  9300.  
  9301.                         02h     PRINT Cancel File
  9302.                         On entry, AL=2 and DS:DX points to the ASCIIZ string for
  9303.                         the print file you want to cancel. Global filename
  9304.                         characters are allowed in the filename.
  9305.                 DS:DX   pointer to ASCIIZ file name to cancel (wildcards OK)
  9306.                 return  CF      set if error
  9307.                                 AX      error code
  9308.  
  9309.                         03h     PRINT Remove All Files
  9310.                 return  CF      set if error
  9311.                                 AX      error code
  9312.  
  9313.                         04h     PRINT Hold Queue/Get Status
  9314.                         This call holds the jobs in the print queue so that you
  9315.                         can scan the queue. Issuing any other code releases the
  9316.                         jobs. On entry, AL=4. On return, DX contains the error
  9317.                         count. DS:SI points to the print queue. The print queue
  9318.                         consists of a series of filename entries. Each entry is
  9319.                         64 bytes long. The first entry in the queue is the file
  9320.                         currently being printed. The end of the queue is marked
  9321.                         by the entry having a null as the first character.
  9322.                return   DX      error count
  9323.                         DS:SI   pointer to print queue (null-string terminated
  9324.                                 list of 64-byte ASCIIZ filenames)
  9325.                         CF      set if error
  9326.                                 AX      error code
  9327.                                         01h     function invalid
  9328.                                         02h     file not found
  9329.                                         03h     path not found
  9330.                                         04h     too many open files
  9331.                                         05h     access denied
  9332.                                         08h     queue full
  9333.                                         09h     spooler busy
  9334.                                         0Ch     name too long
  9335.                                         0Fh     drive invalid
  9336.  
  9337.                         05h     PRINT release print jobs
  9338.                 return  none
  9339.                 note 1) This call has no parameters.
  9340.                      2) Restarts the print queue.  This call must be called
  9341.                         to restart the current print job or after calling
  9342.                         function 04h to pause the print job.
  9343.  
  9344.                         06h     PRINT get printer device (DOS 3.3+)
  9345.                 return  CF      clear   OK
  9346.                                 AX      0000h
  9347.                         CF      set
  9348.                                 AX      0008h   (ERROR_QUEUE_FULL)
  9349.                                 DS:SI   pointer to printer device header 
  9350.                                         struc.
  9351.                 note 1) This call has no parameters.
  9352.                      2) 
  9353.  
  9354.  
  9355.  
  9356. Function  05h   DOS 3.0+ Critical Error Handler
  9357. entry   AH      05h
  9358.         AL      00h     Installation Check
  9359.                 return  AL      00h     not installed, OK to install
  9360.                                 01h     not installed, not OK to install
  9361.                                 0FFh    installed
  9362.                 note    This set of functions allows a user program to
  9363.                         partially or completely override the default
  9364.                         critical error handler in COMMAND.COM.
  9365.         AL      xxh     Handle Error - nonzero error code in AL
  9366.                         (xxh indicates nonzero extended error code)
  9367.                 return  CF      clear
  9368.                         ES:DI   pointer to ASCIIZ error message
  9369.                         AL      (?)
  9370.                         CF      set     use default error handler
  9371. for LANtastic LANOS:
  9372. entry   AH      05h
  9373.         AL      00h     for installation check
  9374.                 #       for error code (in pre DOS 4.00)
  9375.                 1 or 2  for error code in DOS 4.00
  9376.         BX      in      Error code
  9377. return  CF      clear   if error code converted to text
  9378.                 set     if error code can't be converted
  9379.         ES:DI   pointer to ASCIIZ text buffer containing error text. This is a
  9380.                 read-only text buffer and you must not alter the text in this
  9381.                 buffer.
  9382.  
  9383.  
  9384. Function  06h   ASSIGN
  9385. entry   AH      06h
  9386.         AL      00h     Installation Check
  9387.                 01h     Get Memory Segment
  9388. return (AH=00h) AL      (to 4.01) nonzero if ASSIGN is installed
  9389.                         (5.0)      0FFh if ASSIGN is installed
  9390.        (AH=01h) ES      segment of ASSIGN work area
  9391. note 1) Many references report the return value in AH, but this call appears
  9392.         to return its information in AL.
  9393.      2) Microsoft Press' "Advanced MSDOS Programming" (Second Edition)
  9394.         documents int 2Fh, AX=2000 to check for ASSIGN, but according to
  9395.         Ray Duncan (the author) this is a typo.
  9396.  
  9397.  
  9398. Function   08h  DRIVER.SYS
  9399. entry   AH      08h
  9400.         AL      00h     Installation Check
  9401.                 return  AL      00h     not installed, OK to install
  9402.                                 01h     not installed, not OK to install
  9403.                                 0FFh    installed
  9404.                 01h     Add New Block Device
  9405.                         DS:DI   pointer to device driver header
  9406.                 note    Moves down list of drivers, copying and modifying word
  9407.                         at offset 29h. Device driver appended to driver chain.
  9408.                 02h     Execute Device Driver Request
  9409.                         ES:BX   pointer to device driver request header
  9410.                 return  Request header updated as per requested operation.
  9411.  
  9412.  
  9413. Function   10h  SHARE                                   (DOS 3.0+)
  9414. entry   AH      10h
  9415.         AL      00h     Installation Check
  9416. return  AL      00h     not installed, OK to install
  9417.                 01h     not installed, not OK to install
  9418.                 0FFh    installed
  9419. note 1) Values of AL other than 00h appear to put DOS 3.3 SHARE into an
  9420.         infinite loop.
  9421.      2) PC-MOS/386 will always report SHARE.EXE as being present, as its
  9422.         functions are duplicated within the PC-MOS/386 kernel.
  9423.      3) If DOS 4.0's SHARE is loaded manually, either in the CONFIG or AUTOEXEC
  9424.         file, it can't access the NUL device if 4DOS 3.x is installed. If
  9425.         SHARE.EXE is in the root, the problem doesn't usually occur. It's been
  9426.         reported that 4DOS is not the only program that has problems with
  9427.         SHARE.EXE and the NUL device, so it's more likely to be an MS-DOS
  9428.         problem than a 4DOS problem.  (dgh on BIX)
  9429.      4) MS Windows intercepts this call and always returns nonzero regardless
  9430.         of SHARE's presence.  If your program uses file sharing you should
  9431.         try locking and reading a file and watch for the error codes returned
  9432.         by int 21h/5Ch. (Lock/Unlock File)
  9433.      5) SHARE function is built into DR-DOS 3.4x, but was removed to a 
  9434.         separate TSR module in 5.0 and 6.0.
  9435.  
  9436.  
  9437. Function   14h  NLSFUNC.COM
  9438. entry   AH      14h
  9439.         AL      00h     installation check
  9440.                 return  AL      00h     not installed, OK to install
  9441.                                 01h     not installed, not OK to install
  9442.                                 0FFh    installed
  9443.                 01h     unknown
  9444.                 note    Calls int 2Fh/1227h under certain circumstances.
  9445.                 02h     unknown
  9446.                 note    Calls int 2Fh/1227h under certain circumstances.
  9447.                 03h     unknown
  9448.                 note    In DOS 3.3, appears to be identical to subfunction 01h.
  9449. other parameters unknown
  9450.  
  9451.  
  9452. Function   15h  CD-ROM extensions
  9453.                 Microsoft CD-ROM driver versions 1.0 through 2.0 will work
  9454.                 only up to DOS 3.31. DOS 4.0 and up require 2.1 drivers.
  9455.                 MSCDEX abandons INT 13; and redirection within DOS to do its
  9456.                 work. Some LAN software, such as LANtastic, uses the same
  9457.                 mechanism to implement network drives. MSCDEX provides IFS
  9458.                 functionality in any version of DOS back to 3.0.
  9459.  
  9460. entry   AH      15h     CD-ROM services
  9461.         AL      subfunctions
  9462.                 00h     Get Number of CD-ROM Drives (Installation Check)
  9463.                 BX      00h
  9464.                 return  BX      number of CD-ROM drive letters used
  9465.                                 0000h   MSCDEX not installed
  9466.                         CX      starting drive letter (0=A:, 1=B:, etc)
  9467.                 note    This installation check does not follow the format used
  9468.                         by other software.
  9469.  
  9470.                 01h     Get Drive Device List
  9471.                 ES:BX   pointer to buffer to hold drive letter list
  9472.                         (5 bytes per drive letter)
  9473.                 return  buffer filled, for each drive letter:
  9474.                         byte    subunit number in driver
  9475.                         dword   address of device driver header
  9476.  
  9477.                 02h     Get Copyright File Name
  9478.                 CX      drive number (0=A:)
  9479.                 ES:BX   pointer to 38-byte buffer for name of copyright file
  9480.                 return  CF      set if drive is not a CD-ROM drive
  9481.                                 AX      error code  (15h)
  9482.  
  9483.                 03h     Get Abstract File Name
  9484.                 ES:BX   pointer to 38-byte buffer for name of abstract file
  9485.                 CX      drive number (0=A:)
  9486.                 return  CF      set if drive is not a CD-ROM drive
  9487.                                 AX      error code  (15h)
  9488.  
  9489.                 04h     Get Bibliographic Doc File Name
  9490.                 CX      drive number (0=A:)
  9491.                 ES:BX   pointer to 38-byte buffer for name of bibliographic
  9492.                         documentation file
  9493.                 return  CF      set if drive is not a CD-ROM drive
  9494.                                 AX      error code  (15h)
  9495.  
  9496.                 05h     Read VTOC (Volume Table of Contents)
  9497.                 CX      drive number (0=A:)
  9498.                 DX      sector index (0=first volume descriptor, 1=second,...)
  9499.                 ES:BX   pointer to 2048-byte buffer
  9500.                 return  CF      set on error
  9501.                                 AX      error code (15h, 21h)
  9502.                         CF      clear if successful
  9503.                                 AX      volume descriptor type
  9504.                                         00h     other
  9505.                                         01h     standard
  9506.                                         0FFh    terminator
  9507.  
  9508.                 06h     Turn Debugging On
  9509.                 BX      debugging function to enable
  9510.                 note    Reserved for development.
  9511.  
  9512.                 07h     Turn Debugging Off
  9513.                 BX      debugging function to disable
  9514.                 note    Reserved for development.
  9515.  
  9516.                 08h     Absolute Disk Read
  9517.                 CX      drive number (0=A:)
  9518.                 DX      number of sectors to read
  9519.                 ES:BX   pointer to buffer
  9520.                 SI:DI   starting sector number
  9521.                 return  CF      set on error
  9522.                                 AL      error code  (15h, 21h)
  9523.  
  9524.                 09h     Absolute Disk Write
  9525.                 CX      drive number (0=A:)
  9526.                 DX      number of sectors to write
  9527.                 ES:BX   pointer to buffer
  9528.                 SI:DI   starting sector number
  9529.                 note    Corresponds to int 26h and is currently reserved and
  9530.                         nonfunctional.
  9531.  
  9532.                 0Ah     Reserved by Microsoft
  9533.  
  9534.                 0Bh     CD-ROM 2.00 - Drive Check
  9535.                 CX      drive number (0=A:)
  9536.                 return  BX      0ADADh if MSCDEX.EXE installed
  9537.                         AX      0000h   if drive not supported
  9538.                                 <>0     if supported
  9539.  
  9540.                 0Ch     CD-ROM 2.00 - Get MSCDEX.EXE Version
  9541.                 return  BH      major version
  9542.                         BL      minor version
  9543.                 note    MSCDEX.EXE versions prior to 1.02 return BX=0.
  9544.  
  9545.                 0Dh     CD-ROM 2.00 - Get CD-ROM Drive Letters
  9546.                 ES:BX   pointer to buffer for drive letter list
  9547.                         (1 byte per drive)
  9548.                 return  Buffer filled with drive numbers (0=A:). Each byte
  9549.                         corresponds to the drive in the same position for
  9550.                         function 1501h.
  9551.  
  9552.                 0Eh     CDROM 2.00 - Get/Set Volume Descriptor Preference
  9553.                 BX      subfunction
  9554.                         00h     Get Preference
  9555.                         DX      0000h
  9556.                         return  DX      preference settings
  9557.                         01h     Set Preference
  9558.                         DH      volume descriptor preference
  9559.                                 01h     primary volume descriptor
  9560.                                 02h     supplementary volume descriptor
  9561.                         DL      supplementary volume descriptor preference
  9562.                                 01h     shift-Kanji
  9563.                         CX      drive number (0=A:)
  9564.                         return  CF      set on error
  9565.                                         AX      error code  (01h, 15h)
  9566.  
  9567.                 0Fh     CD-ROM 2.00 - Get Directory Entry
  9568.                 CX      drive number (0=A:)
  9569.                 ES:BX   pointer to ASCIIZ pathname
  9570.                 SI:DI   pointer to 255-byte buffer for directory entry
  9571.                 return  CF      set on error
  9572.                                 AX      error code
  9573.                         CF      clear if succesful
  9574.                                 AX      disk format (0=High Sierra, 1=ISO 9660)
  9575.                 note    Directory entry format:
  9576.                         byte    length of directory entry
  9577.                         byte    length of XAR in LBN's
  9578.                         dword   LBN of data, Intel (little-Endian) format
  9579.                         dword   LBN of data, Motorola (big-Endian) format
  9580.                         dword   length of file, Intel format
  9581.                         dword   length of file, Motorola format
  9582.                ---High Sierra---
  9583.                       6 bytes   date and time
  9584.                         byte    bit flags
  9585.                         byte    reserved
  9586.                ---ISO 9660---
  9587.                       7 bytes   data and time
  9588.                         byte    bit flags
  9589.                ---both formats---
  9590.                         byte    interleave size
  9591.                         byte    interleave skip factor
  9592.                         word    volume set sequence number, Intel format
  9593.                         word    volume set sequence number, Motorola format
  9594.                         byte    length of file name
  9595.                       n bytes   file name
  9596.                         byte    (optional) padding if filename is odd length
  9597.                       n bytes   system data
  9598.  
  9599.                 Error codes:
  9600.                         01h     invalid function
  9601.                         15h     invalid drive
  9602.                         21h     not ready
  9603.  
  9604.  
  9605. Function   16h  MS-DOS Idle Call  (DOS 5.0+, OS/2 2.0, Windows 3.0+)
  9606. entry   AH      16h     idle call
  9607.         AL      80h     
  9608. return  AL      00h     idle call is supported
  9609.                 nonzero idle call is not supported
  9610. note 1) When your program is waiting for user input or otherwise not doing
  9611.         useful work, you can call this function in a loop.  Properly written
  9612.         background programs can monitor this call to determine if it is safe
  9613.         to do processing.  This call originated in Windows 3.0, then the
  9614.         OS/2 2.0 DOS box, and finally in DOS 5, where DOSSHELL uses it so
  9615.         processes can tell the shell when it is safe to swap tasks.
  9616.     
  9617.         The MS 5.0 Technical Reference recommends making sure the int 2Fh
  9618.         vector is nonzero before calling this function.  This would be to
  9619.         ensure you are running a DOS version that has 2Fh support.
  9620.  
  9621.         This call is nonblocking, that is, the system does not suspend the
  9622.         program unless another program is ready to run.  Usually the call
  9623.         returns immediately and the program continues running.
  9624.  
  9625.  
  9626. Function   1Ah  ANSI.SYS   (DOS 4.0+)
  9627. entry   AH      00h     Installation Check
  9628.                 return  AL      00h     not installed
  9629.                                 0FFh    if installed
  9630.                 01h     Get/Set Display Information
  9631.                         CL      5Fh     set information
  9632.                                 7Fh     get information
  9633.                                 DS:DX   pointer to parm block as for int 21h,
  9634.                                         AX=440Ch, CX=037Fh/035Fh respectively
  9635.                 return  CF      set     on error
  9636.                                         AX      error code (unknown)
  9637.                                 clear   if successful
  9638.                 note 1) AX is destroyed.
  9639.                      2) May be the DOS IOCTL interface to ANSI.SYS.
  9640.  
  9641.  
  9642. Function   1Bh  XMA2EMS.SYS   (DOS 4.0+)
  9643. entry   AH      00h     Installation Check
  9644.                 return  AL      0FFh    if installed
  9645.                 01h     Get Hidden Frame Information
  9646.                         DI      hidden physical page number
  9647.                 return  AX      0000h if successful
  9648.                                         ES      segment of page frame
  9649.                                         DI      physical page number
  9650.                                 0FFFFh if failed (no such hidden page)
  9651. note 1) XMA2EMS.SYS extension is only installed if DOS has page frames to hide.
  9652.         This extension hooks onto int 67h fn58h and returns from that call data
  9653.         which excludes the physical pages being used by DOS.
  9654.      2) Fn 02h corresponds to the data edited out of the int 67h/fn 58h call.
  9655.  
  9656.  
  9657. Function  43h   Microsoft Extended Memory Specification (XMS)
  9658.                 The XMS version 2.00 for MS-DOS allows DOS programs to utilize
  9659.                 additional memory found in 80286 and 80386 machines. With some
  9660.                 restrictions, XMS adds about 64K to the 640K which DOS programs
  9661.                 can access directly. XMS also provides DOS programs with a
  9662.                 standard method of storing data in extended memory.
  9663.                 See Chapter 10 for API.
  9664.  
  9665.  
  9666. Function  48h   DOSKEY.COM (DOS 5.0+)
  9667. entry   AH      48h     DOSKEY.COM
  9668.         AL      00h     Get Installed State
  9669. return  AL      00h     not installed
  9670.                 0FFh    installed
  9671.  
  9672.         AL      10h     Read Command Line
  9673.                 DS:DX   pointer to buffer to take the command line
  9674.                         buffer:
  9675.                         offset  description
  9676.                         00h     buffer size (max 128 bytes)
  9677.                         01h     the number of characters, minus 1.  The final
  9678.                                 CR is copied to the buffer but not included in
  9679.                                 the byte count.
  9680.                         02h     the first byte of the input line.
  9681. return  AX      0000h
  9682.                 DS:DX   filled with command line
  9683. note    AX=0 if the user types a macro name, and the buffer is not filled.
  9684.         Your program must call the function a second time to expand the macro
  9685.         and copy the macro text to the buffer.
  9686.  
  9687.  
  9688. Function  4Ah   DOS 5.0 HMA Services (undocumented)
  9689. entry   AH      4Ah
  9690.         AL      01h     Get Size
  9691. return  BX      number of bytes (possibly 0) of available HMA
  9692.         ES:DI   start of the available HMA
  9693.  
  9694.  
  9695. Function  64h   SCRNSAV2
  9696. entry   AH      64h
  9697.         AL      00h     installation check
  9698. return  AL      00h     not installed
  9699.                 0FFh    installed
  9700. note    SCRNSAV2.COM is a screen blanker for PS/2s with VGA by Alan Ballard.
  9701.  
  9702.  
  9703. Function  7Ah   Novell NetWare
  9704. entry   AH      7Ah
  9705.         AL      00h     installation check
  9706. return  AL      00h     not installed
  9707.                 0FFh    installed
  9708.         ES:DI   pointer to FAR entry point for routines otherwise accessed
  9709.                 through int 21h
  9710. note 1) Returns address of entry point for IPX and SPX.
  9711.      2) Parameters are listed in Chapter 13.
  9712.  
  9713.  
  9714. Function  87h   APPEND
  9715. entry   AH      87h
  9716.         AL      00h     APPEND installation check
  9717.                 return  AH <> 0 if installed
  9718.                 01h     APPEND - unknown
  9719.                 02h     APPEND - version check
  9720. return  unknown
  9721.  
  9722.  
  9723. Function  88h   Microsoft Networks
  9724. entry   AH      88h
  9725.         AL      00h     network program installation check
  9726.                 return  AH <> 0 if installed
  9727.                         BX      installed component flags (test in this order!)
  9728.                            bits 2       messenger
  9729.                                 3       redirector
  9730.                                 6       server
  9731.                                 7       receiver
  9732.                                 other bits not used, do not test
  9733.                 01h     unknown
  9734.                 02h     unknown
  9735.                 03h     get current POST address
  9736.                         return  ES:BX   POST address
  9737.                 04h     set new POST address
  9738.                         ES:BX   new POST address
  9739.                 09h     network version check
  9740.  
  9741.  
  9742. Function  89h   WHOA!           (slows system down for games)
  9743. entry   AH      89h
  9744.         AL      00h     installation check
  9745.                 return  AL      00h     not installed
  9746.                                 0FFh    installed
  9747.                 01h     uninstall
  9748.                 return  AL      0FDh    successful
  9749.                                 0FEh    error
  9750.                 02h     set delay count
  9751.                 BX = delay count (larger values slow system down more)
  9752.                 return  AL      0FDh    successful
  9753.                                 0FEh    error
  9754. note    WHOA!.COM is copyright COMPUTE! Publications and Brad Crandall.
  9755.  
  9756.  
  9757. Function  0AAh  VIDCLOCK.COM
  9758. entry   AH      0AAh
  9759.         AL      00h     installation check
  9760. return  AL      00h     not installed
  9761.                 0FFh    installed
  9762. note    VIDCLOCK.COM is a memory-resident clock by Thomas G. Hanlin III.
  9763.  
  9764.  
  9765. Function  0ADh  KEYB.COM                                        (DOS 3.3+)
  9766. entry   AH      0ADh
  9767.         AL      80h     Get KEYB.COM Version Number
  9768. return
  9769.         BX      00h     not installed
  9770.                 nonzero installed
  9771.                         BH      major version number
  9772.                         BL      minor version number
  9773. ---
  9774.         AL      81h     Set KEYB.COM Active Code Page
  9775.         BX      code page ID
  9776.                 437     USA
  9777.                 850     Multilingual (Latin I)
  9778.                 852     Multilingual (Latin II)
  9779.                 860     Portuguese
  9780.                 863     French-Canadian
  9781.                 865     Nordic
  9782. return  CF      clear   successful
  9783.                 set
  9784.                 AX      0001h   if code page is not valid
  9785. ---
  9786.         AL      82h     Set KEYB.COM Country Flag
  9787.         BL      00h     domestic (USA) keyboard
  9788.                 0FFh    not USA keyboard
  9789. return  CF      clear   successful
  9790.                 set     invalid value was passed in BL
  9791. ---
  9792.         AL      83h     Get KEYB.COM Country Flag
  9793. return  BL      current country flag value (should be 00h or 0FFh)
  9794.  
  9795. note    Some of these functions are available in DOS 3.3 and 4.0, but were
  9796.         not documented.  These descriptions are for DOS 5.0.
  9797.  
  9798.  
  9799. Function  0B0h  GRAFTABL.COM                                    (DOS 3.3+)
  9800. entry   AH      0B0h
  9801.         AL      00h     installation check
  9802.         return  AL      00h     not installed, OK to install
  9803.                         0FFh    installed
  9804. note 1) Also used by DISPLAY.SYS.
  9805.  
  9806.  
  9807. Function  0B7h  APPEND.EXE                                      (DOS 3.3+)
  9808. entry   AH      0B7h
  9809.         AL      00h     installation check
  9810.                 return  AH      00h     not installed
  9811.                                 nonzero installed (3.3-4.0)
  9812.                                 0FFh    installed (5.0)
  9813.  
  9814.                 01h     unknown
  9815.  
  9816.                 02h     version check
  9817.                 return  AH      minor version number, otherwise
  9818.                         AL      major version number
  9819.                 note    The MS 5.0 TR reports AX should be 0FFFFh for versions
  9820.                         compatible with DOS 5.0.  However, DOS 4.0 returns
  9821.                         the same value.
  9822.  
  9823.                 03h     unknown
  9824.  
  9825.                 04h     get APPEND directory list address       (DOS 4.0+)
  9826.                 return  ES:DI   pointer to active APPEND path (128 bytes max)
  9827.                                 in ASCIIZ format
  9828.  
  9829.                 05h     unknown
  9830.  
  9831.                 06h     get APPEND modes flag                   (DOS 4.0+)
  9832.                 return  BX      APPEND state
  9833.                            bits 0       set if APPEND enabled
  9834.                                 1-B     reserved, must be zero
  9835.                                 C       appends dirs to file requests that
  9836.                                         already specify a drive
  9837.                                 D       applies dirs to file requests that
  9838.                                         already specify a PATH.  Set if /PATH
  9839.                                         flag active
  9840.                                 E       stores the appended dirs in the APPEND
  9841.                                         environment variable.  Set if /E flag
  9842.                                         active
  9843.                                 F       applies dirs to functions like EXEC
  9844.                                         (21h/4B00h) or FIND FIRST (21h/4Eh).
  9845.                                         Set if /X flag active.
  9846.                 note    Returns the current operation modes for APPEND.
  9847.  
  9848.                 07h     set APPEND modes flag                   (DOS 4.0+)
  9849.                         BX      APPEND state bits (see 06h)
  9850.                 return  none
  9851.  
  9852.                 08h     unknown
  9853.                 09h     unknown
  9854.                 0Ah     unknown
  9855.                 10h     unknown
  9856.  
  9857.                 11h     set TRUENAME flag                       (DOS 4.0+)
  9858.                 note 1) This call has no parameters.
  9859.                      2) If the next int 21h call is function 3Dh, 43h, 4Eh or
  9860.                         6Ch, the fully qualified filename is written over top
  9861.                         of the filename passed to the int 21h call. The
  9862.                         application must provide a sufficiently large buffer.
  9863.                         This state is reset after APPEND processes the call.
  9864.  
  9865. note 1) (4.0+) The full path name can be retrieved by doing a int 2Fh fn 0B711h
  9866.         before an open (int 21h 3Dh or 6Ch). The full path is put in your
  9867.         ASCIIZ string when you do the open, so be sure it is long enough.
  9868.      2) The APPEND command apparently covers parts of int 21h/6Ch even though
  9869.         Microsoft's 4.01 User's Reference says it covers only 0Fh, 23h, 2Dh,
  9870.         11h, 4Eh & 4Bh, some of those do require special switches. For 6Ch, it
  9871.         may be a function of the DX register. If DX=xx1x it looks only in the
  9872.         current directory, if DX=xx0x it will search the full append path. DX
  9873.         is called the open flag and gives what action to take if the file exits
  9874.         or does not exist.
  9875.  
  9876.  
  9877. Function  0B8h  Network
  9878. entry   AH      0B8h
  9879.         AL      00h     installation check
  9880.                 return  AH      00h     not installed
  9881.                                 <>0     installed
  9882.                         BH      00h
  9883.                         BL      installed component flags (test in this order
  9884.                            bits 0000100 server             according to PC-LAN)
  9885.                                 0000100 messenger
  9886.                                 0100000 receiver
  9887.                                 1000000 redirector
  9888. (LANtastic)     return  AL      00h     neither redirector or server installed
  9889.                                 0FFh    redirector or server installed
  9890.                         BL      bits indicating which software is installed
  9891.                                (both will be set when both software is running)
  9892.                                 01000000b       server is installed
  9893.                                 00001000b       redirector is installed
  9894.                 01h     unknown
  9895.                 02h     unknown
  9896.                 03h     get current POST address
  9897.                 return  ES:BX   POST address
  9898.                 04h     set new POST address
  9899.                         ES:BX   new POST address
  9900.                 note 1) When a POST address is set, it gets control on any
  9901.                         network event (message-received or network error).
  9902.                      2) Inputs to Message-Received Event Handler
  9903.                         entry   AH      00h
  9904.                                 AL      00h     single block message
  9905.                                 DS:SI   pointer to ASCIIZ originator name
  9906.                                 DS:DI   pointer to ASCIIZ destination name
  9907.                                 ES:BX   pointer to text header
  9908.                         entry   AH      00h
  9909.                                 AL      01h     start multiple block message
  9910.                                 DS:SI   pointer to ASCIIZ originator name
  9911.                                 DS:DI   pointer to ASCIIZ destination name
  9912.                                 CX      block group identifier
  9913.                         entry   AH      00h
  9914.                                 AL      02h     multiple block text
  9915.                                 CX      block group identifier
  9916.                                 ES:BX   pointer to text header
  9917.                         entry   AH      00h
  9918.                                 AL      03h     end multiple block message
  9919.                                 CX      block group identifier
  9920.                         entry   AH      00h
  9921.                                 AL      04h     message aborted due to error
  9922.                                 CX      block group identifier
  9923.                         entry   AH      00h
  9924.                                 AL      04h     message aborted due to error
  9925.                                 CX      block group identifier
  9926.                         entry   AH      00h
  9927.                                 AL      04h     message aborted due to error
  9928.                                 CX      block group identifier
  9929.                 return  AL      00h     user POST routine processed the message
  9930.                                 01h     the network will process the message
  9931.                                 0FFh    network will process message, but
  9932.                                         message window will not be displayed
  9933.                      2) Inputs to Network Critical Error Handler
  9934.                         entry   AH      01h
  9935.                                 AL      01h     server received badly formatted
  9936.                                                 network request
  9937.                         return  0FFh    network will process the error
  9938.                         entry   AH      01h
  9939.                                 AL      02h     unexpected network error
  9940.                         return  00h     user POST routine handled error OK
  9941.                                 01h     reissue network control block
  9942.                                 0FFh    network will process the error
  9943.                         entry   AH      01h
  9944.                                 AL      03h     server got DOS int 24h error
  9945.                         return  00h     user POST routine handled error OK
  9946.                                 0FFh    network will process the error
  9947.                      3) Use an IRET to return from POST handler.
  9948.                      4) For multiple block messages, the application must
  9949.                         respond with the same AX value for all message blocks
  9950.                         in a single message group.
  9951.                      5) Text header format:
  9952.                         DW      length          ;length of text
  9953.                         DB      length dup(?)   ;text of message
  9954.                      6) Network event handlers should not user DOS FCB calls,
  9955.                         attempt to allocate memory, or terminate a running app.
  9956.                 05h     unknown
  9957.                 06h     unknown
  9958.                 07h     unknown
  9959.                 08h     unknown
  9960.                 09h     version check
  9961.                 return  AH      major version number
  9962.                         AL      minor version number
  9963.                 note    The version numbers are returned in hexadecimal. For
  9964.                         example, version 2.52 would be:
  9965.                         AH      2
  9966.                         AL      34h (52 decimal)
  9967.  
  9968.  
  9969. Function  0C7h  Artisoft LANtastic AI-LANBIOS
  9970. note    This is the default entry point for the LANtastic NOS serial and
  9971.         parallel port drivers.
  9972.  
  9973.  
  9974. Function 0D44Dh 4DOS v3.01,+ Command Interpreter  (COMMAND.COM replacement)
  9975. entry   AX      0D44Dh  4DOS installation check
  9976. return  If 4DOS is present in memory the following values will be returned:
  9977.         AX      44DDh
  9978.         BH      minor 4DOS version number
  9979.         BL      major 4DOS version number (same format as DOS int 21h/fn 30h)
  9980.         CX      4DOS PSP segment address
  9981.         DL      4DOS shell number (0 for the first shell, 1 for the second,
  9982.                 etc.; incremented each time a new copy of 4DOS is loaded over a
  9983.                 root copy, either in a different multitasker window or via
  9984.                 nested shells)
  9985. note 1) (excerpted from 4DOS 3.01 manual)
  9986.         4DOS now generates two different INT 2F calls to allow TSRs to
  9987.         tell when 4DOS is back at the prompt.  These calls have AX =
  9988.         D44Eh.  The first occurs immediately before displaying the
  9989.         prompt, with BX = 0; the second occurs after displaying the
  9990.         prompt and immediately before accepting keyboard input, with BX =
  9991.         1.  Any routine intercepting these calls should preserve at least
  9992.         the SI, DI, BP, SP, DS, ES, and SS registers.
  9993.      2) This function (440Dh) is only available in swapping mode.  It tells you
  9994.         if 4DOS is loaded in memory, but not whether it is the parent
  9995.         process of your program.  You can determine if 4DOS is the parent
  9996.         process by comparing the PSP value returned in CX to the PSP
  9997.         chain pointer at offset 16h in your program's PSP.
  9998.  
  9999.  
  10000. Function  0E3h  AnarKey    (keyboard command stack and alias program)
  10001. entry   AH      0E3h
  10002.         AL      00h     installation check
  10003.         return  AL      00h     not installed
  10004.                         0FFh    installed
  10005. note    (excerpted from the AnarKey documentation)
  10006.         Upon installation, ANARKEY hooks into two interrupts:
  10007.         1) Interrupt used to install program signature
  10008.                 -DOS versions before 3.1 use one interrupt between 60h-67h
  10009.                 -DOS 3.1 and later use interrupt 2Fh
  10010.         2) Interrupt 21h, function 0Ah
  10011.         Upon initial program execution, a program "signature" is installed which
  10012.         is used by ANARKEY to prevent itself from being installed more than
  10013.         once. Depending upon the DOS version, a different method of signature
  10014.         installation is performed.
  10015.          Under DOS 2.x thru 3.0, ANARKEY scans interrupt vectors 60h thru 67h
  10016.         searching for an unused vector (signified by a null value).  If an
  10017.         unused vector is found, ANARKEY takes it and installs its program
  10018.         signature there. If all the vectors are in use, ANARKEY does not
  10019.         install a program signature.
  10020.          Running DOS 3.1 and later, ANARKEY chains into interrupt 2Fh. By
  10021.         default, ANARKEY appropriates process number 0E3h.
  10022.  
  10023.  
  10024. Function  0F7h  AUTOPARK.COM  (PD TSR hard disk parking utility)
  10025. entry   AH      0F7h
  10026.         AL      00h     installation check
  10027.                 return  AL      00h     not installed
  10028.                                 0FFh    installed
  10029.         01h     set parking delay
  10030.                 BX:CX   32 bit count of 55ms timer ticks
  10031. note    AUTOPARK is a TSR HD parker by Alan D. Jones.
  10032.  
  10033.  
  10034. Function        Intel Communicating Applications Standard (CAS 1.01A)
  10035. entry   AH              (default; CAS multiplex number can be user-adjusted)
  10036.         AL      00h     Get Installed State
  10037.                         return  AL      00h     not installed
  10038.                                         01h     not installed, not OK to install
  10039.                                         0FFh    installed
  10040.                         note    No errors are returned.
  10041.                 01h     Submit a Task
  10042.                         DS:DX   ptr to ASCIIZ path and name of Task Control File
  10043.                         return  AX      positive event handle or neg. error code
  10044.                         note    Files associated with a task must stay in
  10045.                                 existence until the task is complete or an
  10046.                                 error will result.
  10047.                 02h     Abort the Current Event
  10048.                         return  AX      event handle of aborted event or
  10049.                                         negative error code
  10050.                         note    Terminating an event is not instantaneous. It
  10051.                                 might take up to 30 seconds.
  10052.                 03h     reserved
  10053.                 04h     reserved
  10054.                 05h     Find First Entry in Queue
  10055.                         CX      Status of the event you are seeking. This value
  10056.                                 is compared with the field at offset 2 of the
  10057.                                 Control File
  10058.                                 0 - event has successfully completed
  10059.                                 1 - event is waiting to be processed
  10060.                                 2 - number has been dialed
  10061.                                 3 - connection has been made (sending)
  10062.                                 4 - connection has been made (receiving)
  10063.                                 5 - event was aborted
  10064.                                -1 - chooses an event without regard to status
  10065.                                     This value will probably be used most often
  10066.                                 Other negative values match error codes in
  10067.                                 Control File.
  10068.                         DH      direction:
  10069.                                 0 - Search forward chronologically (from the
  10070.                                     first to the last occurring event)
  10071.                                 1 - Search backward chronologically (from the
  10072.                                     last to the first occurring event)
  10073.                         DL      queue to search:
  10074.                                 0 - Find first control file in Task Queue
  10075.                                 1 - Find first control file in Receive Queue
  10076.                                 2 - Find first control file in Log Queue
  10077.                         return  AX      0, if successful, or negative error code
  10078.                                 BX      event handle for this file
  10079.                 06h     Find Next Entry in Queue
  10080.                         DL      queue to search:
  10081.                                 0 - Find next control file in Task Queue
  10082.                                 1 - Find next control file in Receive Queue
  10083.                                 2 - Find next control file in Log Queue
  10084.                         return  AX      0, if successful, or negative error code
  10085.                                 BX      event handle for this file
  10086.                 07h     Open a File
  10087.                         BX      event handle
  10088.                         CX      receive file number
  10089.                                 0 - the Receive Control File
  10090.                                 1 - first received file
  10091.                                 2 - second received file
  10092.                                 3 - third received file
  10093.                                 n - nth received file
  10094.                         DL      queue:
  10095.                                 0 - open control file in Task Queue
  10096.                                 1 - open control file in Receive Queue or the
  10097.                                     received data
  10098.                  file specified in the CX register.
  10099.                                 2 - Open control file in Log Queue.
  10100.                         return  AX      0 if successful, or negative error code
  10101.                                 BX      DOS file handle for the requested file
  10102.                 08h     Delete a File
  10103.                         BX      event handle
  10104.                         CX      receive file number
  10105.                                 0 - delete all files associated with a specific
  10106.                                     Receive Control File (including the RCF)
  10107.                                 1 - delete first received file associated with
  10108.                                     the event handle
  10109.                                 2 - delete the second received file associated
  10110.                                     with the event handle.
  10111.                                 n - delete the nth received file associated with
  10112.                                     the event handle
  10113.                         DL      queue:
  10114.                                 0 - delete control file in Task Queue
  10115.                                 1 - delete a file or files associated with an
  10116.                                     event in the Receive Queue.
  10117.                                 2 - delete control file in Log Queue
  10118.                                     note   It is strongly recommended that this
  10119.                                     function NOT be used to delete individual
  10120.                                     Log Control Files to maintain the integrity
  10121.                                     of the log.
  10122.                         return  AX      0 if successful, or negative error code
  10123.                 09h     Delete All Files (in a queue)
  10124.                         DL      queue:
  10125.                                 0 - delete all control files in the Task Queue
  10126.                                 1 - delete all control files in the Receive
  10127.                                     Queue and all received files
  10128.                                 2 - delete all control files in the Log Queue
  10129.                         return  AX      0 if successful or negative error code
  10130.                 0Ah     Get Event Date
  10131.                         BX      event handle of event whose date you want to get
  10132.                         DL      queue:
  10133.                                 0 - task queue
  10134.                                 1 - receive queue
  10135.                                 2 - log queue
  10136.                         return  AX      0 if successful or negative error code
  10137.                                 CX      year  (1980-2099)
  10138.                                 DH      month (1-12)
  10139.                                 DL      day   (1-31)
  10140.                 0Bh     Set Task Date
  10141.                         BX      event handle
  10142.                         CX      year  (1980-2099)
  10143.                         DH      month (1-12)
  10144.                         DL      day   (1-31)
  10145.                         return  AX      0 if successful or negative error code
  10146.                 0CH     Get Event Time
  10147.                         BX      event handle
  10148.                         DL      queue:
  10149.                                 0 - task queue
  10150.                                 1 - receive queue
  10151.                                 2 - log queue
  10152.                         return  AX      0 if successful or negative error code
  10153.                                 CH      hour    (0-23)
  10154.                                 CL      minutes (0-59)
  10155.                                 DH      seconds (0-59)
  10156.                                 DL      0
  10157.                 0DH     Set Task Time
  10158.                         BX      event handle
  10159.                         CH      hour    (0-23)
  10160.                         CL      minutes (0-59)
  10161.                         DH      seconds (0-59)
  10162.                         DL      unused
  10163.                         return  AX      0 if successful or negative error code
  10164.                 0EH     Get External Data Block
  10165.                         DS:DX points to a 256-byte EDB area
  10166.                         return  AX      0 if successful or negative error code
  10167.                         note    EDB area is filled with the External Data Block
  10168.                                 block format: (values in decimal)
  10169.                               Offset Length        Description
  10170.                                  0    1    CAS major version number
  10171.                                  1    1    CAS minor version number
  10172.                                  2    68   ASCIIZ path to directory containing
  10173.                                            Resident Manager and CAS software.
  10174.                                            The path must end with a backslash
  10175.                                  70   13   ASCIIZ name of current phonebook
  10176.                                            (the CAS subdirectory is assumed)
  10177.                                  83   13   AZCIIZ name of current logo file
  10178.                                            (the CAS subdirectory is assumed)
  10179.                                  96   32   ASCIIZ default sender name
  10180.                                  128  21   ASCIIZ CSID (CCITT fax device ID)
  10181.                                  149  107  Reserved
  10182.                 0Fh     Get/Set Autoreceive State
  10183.                         DL      function code:
  10184.                                 0 - get current autoreceive state
  10185.                                 1 - set current state to value in DH
  10186.                                 DH      # rings before answer or 0 to disable
  10187.                         return  AX      current state or negative error code
  10188.                                         0 - Autoreceive disabled
  10189.                                         positive # - # rings before hdw answers
  10190.                 10h     Get Current Event Status
  10191.                         DS:DX   pointer to a 444 byte status area
  10192.                         return  AX      0 if successful or negative error code
  10193.                                 BX      number of the current event (AX=0)
  10194.                 11h     Get Queue Status
  10195.                         DL      queue:
  10196.                                 0 - find status of Task Queue
  10197.                                 1 - find status of Receive Queue
  10198.                                 2 - find status of Log Queue
  10199.                         return  AX      # changes to queue since Resident
  10200.                                         Manager started or negative error code
  10201.                                         If changes exceeds 7FFFH, the count
  10202.                                         begins again at 0.
  10203.                                 BX      current # of Control Files in queue
  10204.                                 CX      current # of received files
  10205.                 12h     Get Hardware Status
  10206.                         DS:DX   pointer to a 128-byte status area
  10207.                         return  AX      0 if successful, negative if not
  10208.                         DS:DX   pointer to filled 128-byte status area
  10209.                 13h     Run Diagnostics
  10210.                         DL      Mode
  10211.                                 0 - report progress of diagnostics
  10212.                                 1 - start running diagnostics
  10213.                         return  if DL=1, AX=0 or a negative error code.
  10214.                                 if DL=0, AX=40h or positive number indicating
  10215.                                          diagnostics passed. A negative value
  10216.                                          indicates failure and containes the
  10217.                                          error code
  10218.                 14h     Move Received File
  10219.                         BX      event handle
  10220.                         CX      receive file number
  10221.                                 (must be nonzero to specify a received file)
  10222.                                 1 - first received file
  10223.                                 2 - second received file
  10224.                                 3 - third received file
  10225.                                 n - nth received file
  10226.                         DS:DX   pointer to new ASCIIZ pathname and filename.
  10227.                                 This file must not exist already
  10228.                         return  AX      0 if successful or negative error code
  10229.                         note    The path to the new directory must exist.
  10230.                                 This function cannot create directories.
  10231.                 15h     Submit a Single File to Send
  10232.                         DS:DX   pointer to variable-length data area
  10233.                         return  AX      positive event handle or neg. error code
  10234.                         note 1) variable-length data area format:
  10235.                              Offset Length    Description
  10236.                                 0    1    Transfer type:
  10237.                                           0 - 200x200 dpi, facsimile mode
  10238.                                           1 - 100x200 dpi, facsimile mode
  10239.                                           2 - file transfer mode
  10240.                                           3-127 - Reserved.
  10241.                                 1    1    Text size (if ASCII file, fax mode)
  10242.                                           0 - 80-column
  10243.                                           1 - 132-column
  10244.                                           2-127 - reserved
  10245.                                 2    2    time to send, in DOS file time format
  10246.                                 4    2    date to send, in DOS file time format
  10247.                                           note: Setting both the time and date
  10248.                                           fields to 0 schedules the file to be
  10249.                                           sent immediately
  10250.                                 6    32   ASCIIZ Destination Name  (To: field)
  10251.                                 38   80   ASCIIZ pathname of the file to send
  10252.                                 118  47   ASCIIZ phone number to call
  10253.                                 165  64   ASCIIZ application-specific tag field
  10254.                                 229  1    reserved; set to zero
  10255.                                 230  1    cover page flag:
  10256.                                           0 - don't send cover page
  10257.                                           1 - send cover page
  10258.                                           2-127 - Reserved
  10259.                                 231  23   reserved; set to zero
  10260.                                 254  var  ASCIIZ cover text (if offset 230=1)
  10261.                              2) The individual fields have the same meaning as
  10262.                                 in a Task Control File
  10263.                              3) You must set all fields, except for the Appli-
  10264.                                 cation-Specific Tag field, before calling this
  10265.                                 function. However, you can set the Destination
  10266.                                 Name and Cover Text fields to an empty string
  10267.                 16h-80h Reserved by Intel for future expansion
  10268.  
  10269.  
  10270.  
  10271. DOS 2Fh functions 01h (PRINT), 02h (ASSIGN), 10h (SHARE):
  10272. return  AX      Error
  10273.                 Codes       Description
  10274.                 01h     invalid function number
  10275.                 02h     file not found
  10276.                 03h     path not found
  10277.                 04h     too many open files
  10278.                 05h     access denied
  10279.                 06h     invalid handle
  10280.                 08h     queue full
  10281.                 09h     busy
  10282.                 0Ch     name too long
  10283.                 0Fh     invalid drive was specified
  10284.         CF      clear (0) if OK
  10285.                 set   (1) if error - error returned in AX
  10286. note 1) The multiplex numbers AH=0h through AH=7Fh are reserved for DOS.
  10287.         Applications should use multiplex numbers 80h through 0FFh.
  10288.      2) When in the chain for int 2Fh, if your code calls DOS or if you execute
  10289.         with interrupts enabled, your code must be reentrant/recursive.
  10290.      3) Important! In versions of DOS prior to 3.0, the int 2Fh vector was
  10291.         initialized to zero rather than being pointed into the DOS service area.
  10292.         You must initialize this vector manually under DOS 2.x.
  10293.  
  10294.  
  10295.  
  10296. ┌─────────────────────────────────────────────────────────────────────────────┐
  10297. │ Miscellaneous Interrupts - in numeric order                                 │
  10298. └─────────────────────────────────────────────────────────────────────────────┘
  10299.  
  10300.  
  10301. ┌─────────────────────────────────────────────────────────────────────────────┐
  10302. │Interrupt 30h   FAR jump instruction for CP/M-style calls ............. 5**15│
  10303. └─────────────────────────────────────────────────────────────────────────────┘
  10304. note 1) The CALL 5 entry point does a FAR jump to here  (not a vector!)
  10305.      2) PC-Tools PC-Cache 5.1 hooks this vector on XTs but not on ATs.
  10306.  
  10307.  
  10308. ┌─────────────────────────────────────────────────────────────────────────────┐
  10309. │Interrupt 31h   Unknown ............................................... 5**16│
  10310. └─────────────────────────────────────────────────────────────────────────────┘
  10311. note    PC-Tools PC-Cache 5.1 hooks this vector on ATs but not on XTs.
  10312.  
  10313.  
  10314. ┌─────────────────────────────────────────────────────────────────────────────┐
  10315. │Interrupt 32h   Unknown ............................................... 5**17│
  10316. └─────────────────────────────────────────────────────────────────────────────┘
  10317.  
  10318.  
  10319. ┌─────────────────────────────────────────────────────────────────────────────┐
  10320. │Interrupt 33h   Used by Microsoft Mouse Driver Function Calls ......... 5**18│
  10321. └─────────────────────────────────────────────────────────────────────────────┘
  10322. note    See Chapter 14 for mouse programming.
  10323.  
  10324.  
  10325. ┌─────────────────────────────────────────────────────────────────────────────┐
  10326. │Interrupt 34h   Turbo C/Microsoft languages - Floating Point emulation  5**19│
  10327. └─────────────────────────────────────────────────────────────────────────────┘
  10328. note    This interrupt emulates opcode 0D8h.
  10329.  
  10330.  
  10331. ┌─────────────────────────────────────────────────────────────────────────────┐
  10332. │Interrupt 35h   Turbo C/Microsoft languages - Floating Point emulation  5**20│
  10333. └─────────────────────────────────────────────────────────────────────────────┘
  10334. note    This interrupt emulates opcode 0D9h.
  10335.  
  10336.  
  10337. ┌─────────────────────────────────────────────────────────────────────────────┐
  10338. │Interrupt 36h   Turbo C/Microsoft languages - Floating Point emulation  5**21│
  10339. └─────────────────────────────────────────────────────────────────────────────┘
  10340. note    This interrupt emulates opcode 0DAh.
  10341.  
  10342.  
  10343. ┌─────────────────────────────────────────────────────────────────────────────┐
  10344. │Interrupt 37h   Turbo C/Microsoft languages - Floating Point emulation  5**22│
  10345. └─────────────────────────────────────────────────────────────────────────────┘
  10346. note    This interrupt emulates opcode 0DBh.
  10347.  
  10348.  
  10349. ┌─────────────────────────────────────────────────────────────────────────────┐
  10350. │Interrupt 38h   Turbo C/Microsoft languages - Floating Point emulation  5**23│
  10351. └─────────────────────────────────────────────────────────────────────────────┘
  10352. note 1) This interrupt emulates opcode 0DCh.
  10353.      2) PC-MOS/386 versions prior to 4.00 use this interrupt to interface
  10354.         with the PC-MOS API. Version 4.00 and later use int 0D4h for the API.
  10355.         See the Chapter 13 for the PC-MOS API.
  10356.  
  10357.  
  10358. ┌─────────────────────────────────────────────────────────────────────────────┐
  10359. │Interrupt 39h   Turbo C/Microsoft languages - Floating Point emulation  5**24│
  10360. └─────────────────────────────────────────────────────────────────────────────┘
  10361. note    This interrupt emulates opcode 0DDh.
  10362.  
  10363.  
  10364. ┌─────────────────────────────────────────────────────────────────────────────┐
  10365. │Interrupt 3Ah   Turbo C/Microsoft languages - Floating Point emulation  5**25│
  10366. └─────────────────────────────────────────────────────────────────────────────┘
  10367. note    This interrupt emulates opcode 0DEh.
  10368.  
  10369.  
  10370. ┌─────────────────────────────────────────────────────────────────────────────┐
  10371. │Interrupt 3Bh   Turbo C/Microsoft languages - Floating Point emulation  5**26│
  10372. └─────────────────────────────────────────────────────────────────────────────┘
  10373. note    This interrupt emulates opcode 0DFh.
  10374.  
  10375.  
  10376. ┌─────────────────────────────────────────────────────────────────────────────┐
  10377. │Interrupt 3Ch   Turbo C/Microsoft languages - Floating Point emulation  5**27│
  10378. └─────────────────────────────────────────────────────────────────────────────┘
  10379. note    This interrupt emulates instructions with an ES segment override.
  10380.  
  10381.  
  10382. ┌─────────────────────────────────────────────────────────────────────────────┐
  10383. │Interrupt 3Dh   Turbo C/Microsoft languages - Floating Point emulation  5**28│
  10384. └─────────────────────────────────────────────────────────────────────────────┘
  10385. note    This interrupt emulates a standalone FWAIT instruction
  10386.  
  10387.  
  10388. ┌─────────────────────────────────────────────────────────────────────────────┐
  10389. │Interrupt 3Eh   Turbo C/Microsoft languages - Floating Point emulation  5**29│
  10390. └─────────────────────────────────────────────────────────────────────────────┘
  10391. note    Unknown.
  10392.  
  10393.  
  10394. ┌─────────────────────────────────────────────────────────────────────────────┐
  10395. │Interrupt 3Fh   Overlay Manager Interrupt (Microsoft LINK.EXE) ........ 5**30│
  10396. └─────────────────────────────────────────────────────────────────────────────┘
  10397. note 1) Default overlay manager interrupt; may be changed with LINK command
  10398.         line switch. (Microsoft/IBM LINK.EXE)
  10399.      2) The Microsoft Dynamic Link Library manager uses this interrupt.
  10400.  
  10401.  
  10402. ┌─────────────────────────────────────────────────────────────────────────────┐
  10403. │Interrupt 40h   Hard Disk BIOS ........................................ 5**31│
  10404. └─────────────────────────────────────────────────────────────────────────────┘
  10405.                 Pointer to disk BIOS entry when a hard disk controller is
  10406.                 installed. The BIOS routines use int 30h to revector the
  10407.                 diskette handler (original int 13h) here so int 40h may be
  10408.                 used for hard disk control.
  10409. note 1) Keyboard interrupt for DEC Rainbow.
  10410.  
  10411.  
  10412. ┌─────────────────────────────────────────────────────────────────────────────┐
  10413. │Interrupt 41h   Hard Disk Parameters .................................. 5**32│
  10414. └─────────────────────────────────────────────────────────────────────────────┘
  10415.                 Pointer to first Hard Disk Parameter Block, normally located
  10416.                 in the controller card's ROM. This table may be copied to RAM
  10417.                 and changed, and this pointer revectored to the new table.
  10418. note 1) XT, AT,XT/2, XT/286, PS/2 except ESDI disks
  10419.      2) format of parameter table is:
  10420.         word    cylinders
  10421.         byte    heads
  10422.         word    starting reduced write current cylinder (XT only, 0 for others)
  10423.         word    starting write pre-comp cylinder
  10424.         byte    maximum ECC burst length
  10425.         byte    control byte
  10426.            bits 0-2     drive option (XT only, 0 for others)
  10427.                 3       set if more than 8 heads
  10428.                 4       always 0
  10429.                 5       set if manufacturer's defect map on max cylinder+1
  10430.                 6       disable ECC retries
  10431.                 7       disable access retries
  10432.         byte    standard timeout (XT only, 0 for others)
  10433.         byte    formatting timeout (XT only, 0 for others)
  10434.         byte    timeout for checking drive (XT only, 0 for others)
  10435.         word    landing zone    (AT, PS/2)
  10436.         byte    sectors/track   (AT, PS/2)
  10437.         byte    0  (zeroes)
  10438.      3) normally vectored to ROM table when system is initialized.
  10439.  
  10440.  
  10441. ┌─────────────────────────────────────────────────────────────────────────────┐
  10442. │Interrupt 42h   Pointer to screen BIOS entry .......................... 5**33│
  10443. └─────────────────────────────────────────────────────────────────────────────┘
  10444.                 Used by EGA, VGA, PS/2.
  10445.                 Relocated (by EGA, etc.) video handler (original int 10h).
  10446.                 Revectors int 10 (BIOS video) calls to EGA BIOS.
  10447.                 Also used by Zenith Z-100.
  10448.                 MCT (Modular Circuit Technology, Taiwan) 4-drive floppy
  10449.                   controller revectors int 13h to here.
  10450.  
  10451.  
  10452. ┌─────────────────────────────────────────────────────────────────────────────┐
  10453. │Interrupt 43h   Pointer to EGA Graphics Character Table ............... 5**34│
  10454. └─────────────────────────────────────────────────────────────────────────────┘
  10455.                 The POST initializes this vector pointing to the default table
  10456.                 located in the EGA ROM BIOS. (PC-2 and up). Not initialized if
  10457.                 EGA not present.
  10458.                  This vector was referred to (mistakenly) as the Video
  10459.                 Parameters table in the original EGA BIOS listings.
  10460.  
  10461.  
  10462. ┌─────────────────────────────────────────────────────────────────────────────┐
  10463. │Interrupt 44h   Pointer to graphics character table ................... 5**35│
  10464. └─────────────────────────────────────────────────────────────────────────────┘
  10465. (0:0110h)       This table contains the dot patterns for the first 128
  10466.                 characters in video modes 4,5, and 6, and all 256 characters
  10467.                 in all additional graphics modes. Not initialized if EGA not
  10468.                 present.
  10469. note 1) EGA/VGA/CONV/PS - EGA/PCjr fonts, characters 00h to 7Fh.
  10470.      2) Novell NetWare - High-Level Language API.
  10471.      3) Also used by Zenith Z-100.
  10472.  
  10473.  
  10474. ┌─────────────────────────────────────────────────────────────────────────────┐
  10475. │Interrupt 45h   Reserved by IBM  (not initialized) .................... 5**36│
  10476. └─────────────────────────────────────────────────────────────────────────────┘
  10477. note    Also used by Zenith Z-100, purpose unknown.
  10478.  
  10479.  
  10480. ┌─────────────────────────────────────────────────────────────────────────────┐
  10481. │Interrupt 46h   Pointer to second hard disk parameter block ........... 5**37│
  10482. └─────────────────────────────────────────────────────────────────────────────┘
  10483.                 AT, XT/286, PS/2
  10484.                 (see int 41h) (except ESDI hard disks) (not initialized unless
  10485.                 specific user software calls for it)
  10486.                 also used by Zenith Z-100
  10487.  
  10488.  
  10489. ┌─────────────────────────────────────────────────────────────────────────────┐
  10490. │Interrupt 47h   Reserved by IBM  (not initialized) .................... 5**38│
  10491. └─────────────────────────────────────────────────────────────────────────────┘
  10492.  
  10493.  
  10494. ┌─────────────────────────────────────────────────────────────────────────────┐
  10495. │Interrupt 48h   Cordless Keyboard Translation ......................... 5**39│
  10496. └─────────────────────────────────────────────────────────────────────────────┘
  10497. (0:0120h)       This vector points to code to translate the cordless keyboard
  10498.                 scancodes into normal 83-key values. The translated scancodes
  10499.                 are then passed to int 9. (not initialized on PC or AT)
  10500.                 This is valid on the IBM PCjr only. IBM built a number of
  10501.                 prototype XT/2 machines with infrared keyboards which were
  10502.                 later sold through salvage outlets, but this was never a
  10503.                 production option.
  10504.  
  10505.  
  10506. ┌─────────────────────────────────────────────────────────────────────────────┐
  10507. │Interrupt 49h   Non-keyboard Scan Code Translation Table Address (PCjr) 5**40│
  10508. └─────────────────────────────────────────────────────────────────────────────┘
  10509. (0:0124h)       PCjr translate table, TI Pro video
  10510.  
  10511.  
  10512. ┌─────────────────────────────────────────────────────────────────────────────┐
  10513. │Interrupt 4Ah   Real-Time Clock Alarm (Convertible, PS/2, EISA) ....... 5**41│
  10514. └─────────────────────────────────────────────────────────────────────────────┘
  10515.                 (not initialized on PC or AT)
  10516.                 Invoked by PS/2 and Convertible BIOS when real-time clock
  10517.                   alarm occurs.
  10518.                 Used by TI Professional PC for keyboard DSR interface
  10519.                   (keyboard BIOS interrupt)
  10520.                   Functions for AH=0, 1, 2 and 5 are identical to IBM's int 16h.
  10521. note    When the RTC alarm function is activated it will generate an interrupt
  10522.         4Ah at the time specified by the previous int 1Ah/06h alarm call.
  10523.         The calling program must point the 4Ah vector to an alarm processing
  10524.         routine before setting the alarm with int 1Ah/06h.  It must also
  10525.         cancel the alarm and resture the 1Ah vector to its original value
  10526.         before returning to DOS.
  10527.  
  10528.  
  10529. ┌─────────────────────────────────────────────────────────────────────────────┐
  10530. │Interrupt 4Bh   Reserved by IBM  (not initialized) .................... 5**42│
  10531. └─────────────────────────────────────────────────────────────────────────────┘
  10532.         Used by IBM Micro Channel SCSI hard disk controllers.
  10533.  
  10534.  
  10535. ┌─────────────────────────────────────────────────────────────────────────────┐
  10536. │Interrupt 4Ch   Reserved by IBM  (not initialized) .................... 5**43│
  10537. └─────────────────────────────────────────────────────────────────────────────┘
  10538.  
  10539.  
  10540. ┌─────────────────────────────────────────────────────────────────────────────┐
  10541. │Interrupt 4Dh   Reserved by IBM  (not initialized) .................... 5**44│
  10542. └─────────────────────────────────────────────────────────────────────────────┘
  10543.  
  10544.  
  10545. ┌─────────────────────────────────────────────────────────────────────────────┐
  10546. │Interrupt 4Eh   Reserved by IBM  (not initialized) .................... 5**45│
  10547. └─────────────────────────────────────────────────────────────────────────────┘
  10548. note    Used instead of int 13h for disk I/O on TI Professional PC.
  10549.  
  10550.  
  10551. ┌─────────────────────────────────────────────────────────────────────────────┐
  10552. │Interrupt 4Fh   Reserved by IBM  (not initialized) .................... 5**46│
  10553. └─────────────────────────────────────────────────────────────────────────────┘
  10554.  
  10555.  
  10556. ┌─────────────────────────────────────────────────────────────────────────────┐
  10557. │Interrupt 50-57 IRQ0-IRQ7 Relocation .................................. 5**47│
  10558. └─────────────────────────────────────────────────────────────────────────────┘
  10559. note 1) Normally not initialized.
  10560.      2) IRQ0-IRQ7 relocated by DesQview.
  10561.      3) IRQ0-IRQ7 relocated by IBM 3278 Emulation Control Program.
  10562.  
  10563.  
  10564. ┌─────────────────────────────────────────────────────────────────────────────┐
  10565. │Interrupt 58h   Reserved by IBM  (not initialized) .................... 5**48│
  10566. └─────────────────────────────────────────────────────────────────────────────┘
  10567.  
  10568.  
  10569. ┌─────────────────────────────────────────────────────────────────────────────┐
  10570. │Interrupt 59h   Reserved by IBM  (not initialized) .................... 5**49│
  10571. └─────────────────────────────────────────────────────────────────────────────┘
  10572.         GSS Computer Graphics Interface (GSS*CGI)
  10573. entry   DS:DX   pointer to block of 5 array pointers
  10574. return  CF      clear
  10575.                 AX      return code
  10576.         CF      set
  10577.                 AX      error code
  10578. note 1) Int 59h is the means by which GSS*CGI language bindings communicate
  10579.         with GSS*CGI device drivers and the GSS*CGI device driver controller.
  10580.      2) Also used by the IBM Graphic Development Toolkit.
  10581.  
  10582.  
  10583. ┌─────────────────────────────────────────────────────────────────────────────┐
  10584. │Interrupt 5Ah   Reserved by IBM  (not initialized)  ................... 5**50│
  10585. └─────────────────────────────────────────────────────────────────────────────┘
  10586. note    IBM Cluster Adapter BIOS entry address.
  10587.  
  10588.  
  10589. ┌─────────────────────────────────────────────────────────────────────────────┐
  10590. │Interrupt 5Bh   Reserved by IBM  (not initialized) .................... 5**51│
  10591. └─────────────────────────────────────────────────────────────────────────────┘
  10592. note    Used by IBM Cluster Adapter.
  10593.  
  10594.  
  10595. ┌─────────────────────────────────────────────────────────────────────────────┐
  10596. │Interrupt 5Ah   Cluster Adapter BIOS entry address .................... 5**52│
  10597. └─────────────────────────────────────────────────────────────────────────────┘
  10598. note    Normally not initialized.
  10599.  
  10600.  
  10601. ┌─────────────────────────────────────────────────────────────────────────────┐
  10602. │Interrupt 5Bh   Reserved by IBM  (not initialized) .................... 5**53│
  10603. └─────────────────────────────────────────────────────────────────────────────┘
  10604. note    Used by cluster adapter?
  10605.  
  10606.  
  10607. ┌─────────────────────────────────────────────────────────────────────────────┐
  10608. │Interrupt 5Ch   NETBIOS interface entry port, TOPS .................... 5**54│
  10609. └─────────────────────────────────────────────────────────────────────────────┘
  10610. note 1) See Chapter 13 for information on network programming.
  10611.      2) The Texas Instruments Professional PC (TI Pro) uses 5Ch for the Pause
  10612.         key on the keyboard. The TI BIOS allows any user routine to execute
  10613.         from the Pause interrupt as long as it eventually returns.
  10614.      3) Used by Windows/386 by Virtual Machine routines.
  10615.      4) Used by Novell Netware 2.0.
  10616.  
  10617.  
  10618. ┌─────────────────────────────────────────────────────────────────────────────┐
  10619. │Interrupt 5Dh   Reserved by IBM  (not initialized) .................... 5**55│
  10620. └─────────────────────────────────────────────────────────────────────────────┘
  10621. note    The Texas Instruments Professional PC (TI Pro) uses 5Ch for the
  10622.         keyboard services.
  10623.  
  10624.  
  10625. ┌─────────────────────────────────────────────────────────────────────────────┐
  10626. │Interrupt 5Eh   Reserved by IBM  (not initialized) .................... 5**56│
  10627. └─────────────────────────────────────────────────────────────────────────────┘
  10628. note    TI Professional PC - Program Break.
  10629.  
  10630.  
  10631. ┌─────────────────────────────────────────────────────────────────────────────┐
  10632. │Interrupt 5Fh   Reserved by IBM  (not initialized) .................... 5**57│
  10633. └─────────────────────────────────────────────────────────────────────────────┘
  10634. note    TI Professional PC - Keyboard queueing.
  10635.  
  10636.  
  10637. ┌─────────────────────────────────────────────────────────────────────────────┐
  10638. │Interrupt 60h-67h  User Program Interrupts ............................ 5**58│
  10639. └─────────────────────────────────────────────────────────────────────────────┘
  10640. note 1) Available for general use.
  10641.      2) Some Adaptec hard disk controllers used these interrupts. Models and
  10642.         usages unknown.
  10643.      3) Various major programs make standardized use of this group of
  10644.         interrupts. Details of common use follows:
  10645.  
  10646.  
  10647. ┌─────────────────────────────────────────────────────────────────────────────┐
  10648. │Interrupt 60h   User Program Interrupt ................................ 5**59│
  10649. └─────────────────────────────────────────────────────────────────────────────┘
  10650. note 1) Used by 10-Net Network OS Interface.
  10651.      2) Used by FTP Driver - PC/TCP Packet Driver Specification.
  10652.      3) See Chapter 13 for network programming calls.
  10653.      4) Used by TOPS netork (TTALK.EXE).
  10654.      5) The 2-The-Max VGA-16 board TSR zoom utility uses this interrupt by
  10655.         default.  (see int 61h for details)
  10656.      6) Versa-Spool print spooler revectors int 17h to here when installing
  10657.         its own 17h handler. (see int 61h also)
  10658.      7) Some older OMTI and Adaptec hard disk controllers used the interrupts
  10659.         from 60h to 63h as 16 bytes of scratch RAM.
  10660.      8) Used by GDOSMEM Windows TSR skeleton.
  10661.         entry   AX      GTSR Identification #
  10662.                 BX      00h     GTSR Installation Check
  10663.         return  BX      GTSR Identification #
  10664.  
  10665.         entry   AX      GTSR Identification #
  10666.                 BX      01h     GTSR Increment WORD in CX:DX
  10667.                 CX      Segment => WORD
  10668.                 DX      Offset  => WORD
  10669.         return  none
  10670.      9) Used by TDOSMEM Windows TSR skeleton.
  10671.         entry   AX      TTSR Identification #
  10672.                 BX      00h     GTSR Installation Check
  10673.         return  BX      GTSR Identification #
  10674.                 CX      Segment => local WORD
  10675.                 DX      Offset  => local WORD
  10676.  
  10677.         entry   AX      TTSR Identification #
  10678.                 BX      01h     GTSR Increment WORD in CX:DX
  10679.         return  none
  10680.  
  10681.  
  10682. ┌─────────────────────────────────────────────────────────────────────────────┐
  10683. │Interrupt 61h  User Interrupt ......................................... 5**  │
  10684. └─────────────────────────────────────────────────────────────────────────────┘
  10685.      1) Default interrupt used by Chris Dunford's PCED 2.0 API.
  10686.      2) Used by Mike Geary's DENYNONE.ASM SHARE.EXE controller.
  10687.  
  10688.         Function  00h   Get Current Mode Value
  10689.         entry   AH      00h
  10690.         return  AL      current mode value
  10691.  
  10692.         Function  01h   Set New Open-Mode Value
  10693.         entry   AH      01h
  10694.                 AL      new value to set
  10695.         return  none
  10696.  
  10697.      3) The 2-The-Max VGA-16 board TSR zoom utility uses this interrupt by
  10698.         default.
  10699.  
  10700.         Function  00h   Zoom
  10701.         entry   AX      0000h
  10702.                 BX      zoom factor (0-7x)
  10703.         return  none
  10704.  
  10705.         Function  01h   Center Zoomed Window
  10706.         entry   AX      0001h
  10707.                 BX      x coordinate to center
  10708.                 CX      y coordinate to center
  10709.         return  none
  10710.         note    'x' and 'y' will be positioned as close to the center of the
  10711.                 display as possible.
  10712.  
  10713.         Function  02h   End Zoom
  10714.         entry   AX      0002h
  10715.         return  none
  10716.         note    Restores screen to original state.
  10717.  
  10718.         Function  03h   Report Zoom
  10719.         entry   AX      0003h
  10720.         return  AX      zoom factor (0-7)
  10721.  
  10722.         Function  04h   Enter Specify Mode
  10723.         entry   AX      0004h
  10724.         return  none
  10725.         note    This mode is entered whenever the predefined hotkey is pressed.
  10726.  
  10727.         Function  05h   Query Zoom Window
  10728.         entry   AX      0005h
  10729.                 BX      segment address of return argument array
  10730.                 CX      offset address of return argument array
  10731.         return  BX:CX   14 byte array
  10732.                         offset[0]  x start of zoom window
  10733.                               [1]  y start of zoom window
  10734.                               [2]  x end of zoom window
  10735.                               [3]  y end of zoom window
  10736.                               [4]  current zoom factor
  10737.                               [5]  zoom offset start x
  10738.                               [6]  zoom offset start y
  10739.  
  10740.         Function  06h   Set Zoom Window
  10741.         entry   AX      0006h
  10742.                 BX      segment address of window coordinate array
  10743.                 CX      offset address of window coordinate array
  10744.         return  BX:CX   array
  10745.                         offset[0]  x start of zoom window
  10746.                               [1]  y start of zoom window
  10747.                               [2]  x end of zoom window
  10748.                               [3]  y end of zoom window
  10749.      4) Versa-Spool print spooler revectors int 1Ch to here when installing
  10750.         its own 1Ch handler.
  10751.  
  10752.  
  10753. ┌─────────────────────────────────────────────────────────────────────────────┐
  10754. │Interrupt 63h  User Program Interrupt                                        │
  10755. └─────────────────────────────────────────────────────────────────────────────┘
  10756. This interrupt is used by Novell NetWare v2.0.
  10757.  
  10758.  
  10759. ┌─────────────────────────────────────────────────────────────────────────────┐
  10760. │Interrupt 64h  User Program Interrupt                                        │
  10761. └─────────────────────────────────────────────────────────────────────────────┘
  10762. This interrupt is used by Novell NetWare IPX versions 1.02-2.0 TBMI.
  10763.  
  10764.  
  10765. ┌─────────────────────────────────────────────────────────────────────────────┐
  10766. │Interrupt 65h  User Program Interrupt                                        │
  10767. └─────────────────────────────────────────────────────────────────────────────┘
  10768. This interrupt is used by Novell NetWare v2.0.
  10769.  
  10770.  
  10771. ┌─────────────────────────────────────────────────────────────────────────────┐
  10772. │Interrupt 67h   User Program Interrupt ................................ 5**60│
  10773. └─────────────────────────────────────────────────────────────────────────────┘
  10774. note 1) Used by Lotus-Intel-Microsoft Expanded Memory Specification 3.1 and
  10775.         higher. (EMS and LIM)
  10776.      2) Used by Ashton-Tate/Quadram/AST Enhanced Expanded Memory Specification
  10777.         3.1 and higher. (EEMS)
  10778.      3) Used by Phar Lap/Quarterdeck VCPI v1.0.
  10779.      4) See Chapter 10 for EMS/EEMS programming information.
  10780.      5) The Advance Digital PC Slave board (also marketed by Alloy) contains
  10781.         its own 8mHz 8086, up to 768K of on-card memory and a built-in
  10782.         monochrome monitor adapter, communicating with an RS232 terminal at
  10783.         19.2KBaud. Their operating system is an adaptation of MSDOS 2.11
  10784.         called RTNX or ATNX. ?TNX uses interrupt 67h for record locking,
  10785.         using an "interrupt 67h semaphore" system in which a data record
  10786.         access must be preceded by a call to int 67h with a string that
  10787.         contains a filename and a record number to lock.
  10788.      6) Some Adaptec hard disk controllers have problems related to their
  10789.         use of int 67h. Supposedly the Adaptec can be made to use a driver
  10790.         instead of ROM. The driver is generated by running the ROM program
  10791.         at C800:5 and this fixes the problem. Apparently this driver is
  10792.         called ADAPTEC.DRV. Check with Adaptec if you suspect a problem.
  10793.      7) IBM issued a known bug report listing a fault in DOS 4.0's network
  10794.         handling within IBMBIO.COM. The exact wording of the report is:
  10795.         UR22624  IR79404   WAIT       IBMBIO   INT 2FH for INT 67H causes hang
  10796.  
  10797.  
  10798. ┌─────────────────────────────────────────────────────────────────────────────┐
  10799. │Interrupt 68h   Not Used  (not initialized) ........................... 5**61│
  10800. └─────────────────────────────────────────────────────────────────────────────┘
  10801. note 1) APPC/PC Network Interface. See Chapter 13.
  10802.      2) Some Toshiba laptop hard disk controllers use this interrupt.
  10803.      3) Used by HDTest to communicate with BIOS entry point.
  10804.      4) Used by Mike Geary's EGA720.ASM (forces EGA into 720x348 mode)
  10805.  
  10806.  
  10807. ┌─────────────────────────────────────────────────────────────────────────────┐
  10808. │Interrupt 69h   Not Used  (not initialized) ........................... 5**62│
  10809. └─────────────────────────────────────────────────────────────────────────────┘
  10810.  
  10811.  
  10812. ┌─────────────────────────────────────────────────────────────────────────────┐
  10813. │Interrupt 6Ah   Not Used  (not initialized) ........................... 5**63│
  10814. └─────────────────────────────────────────────────────────────────────────────┘
  10815. note    Used by SLR System's OPTHELP.COM, a TSR help system for their OPTASM
  10816.         assembler. OPTHELP may be configured to interrupts from 60h to 7Fh.
  10817.  
  10818.  
  10819. ┌─────────────────────────────────────────────────────────────────────────────┐
  10820. │Interrupt 6Bh   Not Used  (not initialized) ........................... 5**64│
  10821. └─────────────────────────────────────────────────────────────────────────────┘
  10822.  
  10823.  
  10824. ┌─────────────────────────────────────────────────────────────────────────────┐
  10825. │Interrupt 6Ch   System Resume Vector (Convertible) .................... 5**65│
  10826. └─────────────────────────────────────────────────────────────────────────────┘
  10827. note 1) This vector is not initialized on the PC, XT, or jr.
  10828.      2) DOS 3.2 Realtime Clock update uses this interrupt.
  10829.  
  10830.  
  10831. ┌─────────────────────────────────────────────────────────────────────────────┐
  10832. │Interrupt 6Dh   Not Used  (not initialized) ........................... 5**66│
  10833. └─────────────────────────────────────────────────────────────────────────────┘
  10834. note    Used internally by VGA adapter -  IBM, Paradise, Video 7, NCR
  10835.  
  10836.  
  10837. ┌─────────────────────────────────────────────────────────────────────────────┐
  10838. │Interrupt 6Eh   Not Used  (not initialized) ........................... 5**67│
  10839. └─────────────────────────────────────────────────────────────────────────────┘
  10840.  
  10841.  
  10842.  
  10843. ┌─────────────────────────────────────────────────────────────────────────────┐
  10844. │Interrupt 6Fh   10-Net API............................................. 5**68│
  10845. └─────────────────────────────────────────────────────────────────────────────┘
  10846. note 1) See Chapter 13 for information on the 10-Net API.
  10847.      2) HP ES-12 Extended BIOS
  10848.         a) Read CMOS Memory
  10849.         entry   AH      22h
  10850.                 BL      address of CMOS byte to read
  10851.                 BP      0012h
  10852.         return  AH      status
  10853.                 AL      byte read
  10854.                 BP, DS  destroyed
  10855.         b) Write CMOS Memory
  10856.         entry   AH      24h
  10857.                 AL      new value
  10858.                 BL      address of CMOS byte to write
  10859.                 BP      0012h
  10860.         return  AH      status
  10861.                 BP, DS  destroyed
  10862.      3) Novell NetWare - PCOX API (3270 PC terminal interface).
  10863.  
  10864.  
  10865. ┌─────────────────────────────────────────────────────────────────────────────┐
  10866. │Interrupt 70h   IRQ 8, Real Time Clock Interrupt (AT, XT/286, PS/2) ... 5**69│
  10867. └─────────────────────────────────────────────────────────────────────────────┘
  10868.  
  10869.         This interrupt services the real-time clock hardware.  The hardware
  10870.         supports 2 modes of operation, an interrupt at a specific 24 hour
  10871.         interval (i.e 9:42 am), or repeatedly every 0.976 ms (1,024 kHz).
  10872.         Both modes can operate at the same time if needed.
  10873.  
  10874.         In the 24 hour alarm mode, the interrupt is vectored here by hardware
  10875.         and interrupt 4Ah is called to alert the application program of the
  10876.         alarm. Int 4Ah is not handled by the BIOS other than to return, and
  10877.         is normally revectored by a particular application using the alarm.
  10878.  
  10879.         When repeating interrupt mode is active, the 32-bit microsecond
  10880.         counter consisting of timer_clk_low and timer_clk_hi is decremented
  10881.         by 976 us on every interrupt.  When the timer reaches zero, the
  10882.         byte pointed to by the offset @timer_wait_off and and segment
  10883.         @timer_wait_seg is set to 80h (this pointer is set by an application
  10884.         program through int 1Ah function ah=6).
  10885.  
  10886.         The Motorola MC146818A real time clock chip, or its equivalent, can be
  10887.         programmed to generate the real time clock interrupt (int 70h)
  10888.         approximately 1024 times per second. The BIOS Real Time Clock ISR is
  10889.         invoked on each real time clock interrupt. Only AT BIOSs support the
  10890.         Real Time Clock ISR.
  10891.  
  10892.         The BIOS initializes the int 70h vector to address F000:5124h.
  10893.  
  10894.         Three AT BIOS functions interface with the int 70h Real Time Clock ISR.
  10895.         These are:
  10896.                 int 15h, AH 83h   Event Wait Interval
  10897.                 int 15h, AH 86h   Wait
  10898.                 int 1Ah, AH 06h   Set User Alarm
  10899.  
  10900.  
  10901. ┌─────────────────────────────────────────────────────────────────────────────┐
  10902. │Interrupt 71h   IRQ 9, Redirected to IRQ 8 (AT, XT/286, PS/2) ......... 5**70│
  10903. └─────────────────────────────────────────────────────────────────────────────┘
  10904. note    LAN Adapter 1 (rerouted to int 0Ah [IRQ2] by BIOS).
  10905.  
  10906.  
  10907. ┌─────────────────────────────────────────────────────────────────────────────┐
  10908. │Interrupt 72h   IRQ 10  (AT, XT/286, PS/2)  Reserved .................. 5**71│
  10909. └─────────────────────────────────────────────────────────────────────────────┘
  10910. note    Hardware servicer (called by hardware 8259-2, IRQ 10).
  10911.  
  10912.  
  10913. ┌─────────────────────────────────────────────────────────────────────────────┐
  10914. │Interrupt 73h   IRQ 11  (AT, XT/286, PS/2)  Reserved .................. 5**72│
  10915. └─────────────────────────────────────────────────────────────────────────────┘
  10916. note    Hardware servicer (called by hardware 8259-2, IRQ 11).
  10917.  
  10918.  
  10919. ┌─────────────────────────────────────────────────────────────────────────────┐
  10920. │Interrupt 74h   IRQ 12  Mouse Interrupt (PS/2) ........................ 5**73│
  10921. └─────────────────────────────────────────────────────────────────────────────┘
  10922. note    Hardware servicer (called by hardware 8259-2, IRQ 12).
  10923.  
  10924.  
  10925. ┌─────────────────────────────────────────────────────────────────────────────┐
  10926. │Interrupt 75h   IRQ 13, Coprocessor Error (AT) ........................ 5**74│
  10927. └─────────────────────────────────────────────────────────────────────────────┘
  10928. note 1) BIOS redirects math coprocessor errors to int 2 (NMI).
  10929.      2) The math co-processor 80287 invokes this interrupt. Int 75h calls the
  10930.         non-maskable interrupt int 2 to halt the system. (80287 is not used if
  10931.         this vector is left pointing here). Programs which use the 80287 must
  10932.         re-vector this interrupt to use the 80287.
  10933.      3) Under DOS 3.2, this interrupt is routed through the DOS interrupt stack
  10934.         pool like device interrupts. However, coprocessor exceptions generally
  10935.         do not resume via IRET and this fill the interrupt pool (stacks
  10936.         allocated and never deallocated) on exceptions. Microsoft has a patch
  10937.         available for DOS 3.2.
  10938.      4) Weitek ABACUS x167 math coprocessor exception handler shares this
  10939.         interrupt with Intel 80x87 if present.
  10940.  
  10941.  
  10942. ┌─────────────────────────────────────────────────────────────────────────────┐
  10943. │Interrupt 76h   IRQ 14, Hard Disk Controller (AT, XT/286, PS/2) ....... 5**75│
  10944. └─────────────────────────────────────────────────────────────────────────────┘
  10945. note 1) Called by hardware 8259-2 IRQ 14.
  10946.      2) When the hard disk controller has completed its task, it signals
  10947.         completion though hardware activation of int 76h. The status in
  10948.         hdsk_int_flags is set to "done", a value of 0FFh. Int 15/fn91h may also
  10949.         be called to signal the interrupt is done.
  10950.  
  10951.  
  10952. ┌─────────────────────────────────────────────────────────────────────────────┐
  10953. │Interrupt 77h   IRQ 15 (AT, XT/286, PS/2)  Reserved ................... 5**76│
  10954. └─────────────────────────────────────────────────────────────────────────────┘
  10955. note    Future services (called by hardware 8259-2 IRQ 15).
  10956.  
  10957.  
  10958. ┌─────────────────────────────────────────────────────────────────────────────┐
  10959. │Interrupt 78h   Not Used .............................................. 5**77│
  10960. └─────────────────────────────────────────────────────────────────────────────┘
  10961. note 1) Used by Novell Netware 2.0 - non-dedicated shell.
  10962.      2) DESQview uses ints 78h-7Fh for itself to revector the 8259 interrupt
  10963.         controllers.
  10964.  
  10965.  
  10966. ┌─────────────────────────────────────────────────────────────────────────────┐
  10967. │Interrupt 79h   Not Used .............................................. 5**78│
  10968. └─────────────────────────────────────────────────────────────────────────────┘
  10969.  
  10970. note 1) Used by LAN:Datacore runtimes for BASIC and C by Lanquest Group in
  10971.         releases after late '86.
  10972.      2) Used by AutoCAD 2.5/2.6 ADI Digitizer interface (default).
  10973.  
  10974.  
  10975. ┌─────────────────────────────────────────────────────────────────────────────┐
  10976. │Interrupt 7Ah   Reserved .............................................. 5**79│
  10977. └─────────────────────────────────────────────────────────────────────────────┘
  10978. note 1) Novell NetWare - Low-Level API APX, versions 2.0a+.  See Chapter 13.
  10979.      2) AutoCAD Device Interface, used by various video boards.
  10980.      3) IBM 3270 Emulator program.
  10981.      4) Also used by early versions of "File Access Utility" by Automated
  10982.         Insurance Resource Systems. AIRS changed to a different interrupt in
  10983.         late '86 to eliminate conflict with Novell.
  10984.      5) Used by LAN:Datacore runtimes for BASIC and C by Lanquest Group in
  10985.         versions 2.5 and higher before late '86. Lanquest changed to int 79h
  10986.         to prevent Novell conflict.
  10987.  
  10988.  
  10989. ┌─────────────────────────────────────────────────────────────────────────────┐
  10990. │Interrupt 7Bh-7Eh  Not Used by IBM .................................... 5**80│
  10991. └─────────────────────────────────────────────────────────────────────────────┘
  10992.         Btrieve API
  10993. entry   register unknown
  10994.         functions:
  10995.         00h     open
  10996.         01h     close
  10997.         02h     insert
  10998.         03h     update
  10999.         04h     delete
  11000.         05h     get_equal
  11001.         06h     get_next
  11002.         07h     get_prev
  11003.         08h     get_greater
  11004.         09h     get_gr_eql
  11005.         0Ah     get_less
  11006.         0Bh     get_less_eq
  11007.         0Ch     get_first
  11008.         0Dh     get_last
  11009.         0Eh     create
  11010.         0Fh     stat
  11011.         10h     extend
  11012.         11h     set_dir: set directory information
  11013.         12h     get_dir: get directory information
  11014.         13h     begin_trans
  11015.         14h     end_trans
  11016.         15h     abort_trans
  11017.         16h     get_pos: get record position number
  11018.         17h     get_direct: get data by sending record position
  11019.         18h     step_direct
  11020.         19h     stop
  11021.         1Ah     version
  11022.         1Bh     unlock
  11023.         1Ch     reset
  11024. return  unknown
  11025. note    Btrieve sets low byte of vector to 33h; this serves as the installation
  11026.         check.
  11027.  
  11028.  
  11029. ┌─────────────────────────────────────────────────────────────────────────────┐
  11030. │Interrupt 7Fh   IBM 8514/A Graphics Adapter API ....................... 5**82│
  11031. └─────────────────────────────────────────────────────────────────────────────┘
  11032. note 1) 59 8514/A API functions available (HDILOAD.EXE) parameters unknown.
  11033.      2) Used by second copy of COMMAND set with SHELL=.
  11034.      3) Not used by COMMAND /C at DOS prompt.
  11035.      4) The IBM RTIC (Real Time Interface Coprocessor) Multiport (and
  11036.         Multiport/2) use int 7Fh as a method of communication between the
  11037.         system-unit resident interrupt handler and the RTIC card's operating
  11038.         system. There is a convention for using it in which register AX
  11039.         contains the signature of the handler that should handle the interrupt.
  11040.         Some signatures are:
  11041.                 AX    0200h    is a call to the current task dispatcher
  11042.                                (from the BTRIEVE application interface).
  11043.                 AX    0101h    is a call from an application to the RTIC
  11044.                                function request mechanism.
  11045.                 AX    0FEEDh   is a call from the ICAINTH.SYS interrupt handler.
  11046.      5) MultiLink Advanced (a custom version of PC-MOS/386), versions 3.03 and
  11047.         higher, from The Software Link, Inc.
  11048.         Function  02h   Invoke user interface (multitasking DOS shell)
  11049.         entry   AH      02h
  11050.                 AL      00h
  11051.         return  unknown
  11052.         Function  0Dh   Set new spooler parameters
  11053.         entry   AH      0Dh
  11054.                 AL      ASCII code for disposition (D,S,H,N)
  11055.                 BH      ASCII code for priority    (0-9)
  11056.                 BL      ASCII code for class       (A-Z)
  11057.         return  AL      Error
  11058.                         00h     OK
  11059.                         01h     no spooler installed
  11060.                         02h     invalid request
  11061.         Function  0Eh   Get spooler parameters
  11062.         entry   AH      0Eh
  11063.         return  AL      01h     if no spooler installed, otherwise:
  11064.                 AL      ASCII code for disposition (D,S,H,N)
  11065.                 BH      ASCII code for priority    (0-9)
  11066.                 BL      ASCII code for class       (A-Z)
  11067.      6) There have been mentions of assorted other little-known programs using
  11068.         this interrupt. In view of its use by DOS and the increasingly-popular
  11069.         8514/A adapter, it would probably be wise to avoid int 7Fh for
  11070.         aftermarket application software.
  11071.      7) Also used by IBM HLLAPI.
  11072.      8) Used internally by later versions of Tom Mack's RBBS-PC BBS system.
  11073.      9) Used by Novell Netware 2.0+ to switch non-dedicated shell to console
  11074.         mode.
  11075.  
  11076.  
  11077. ┌─────────────────────────────────────────────────────────────────────────────┐
  11078. │Interrupt 80h-85h  Reserved by BASIC .................................. 5**83│
  11079. └─────────────────────────────────────────────────────────────────────────────┘
  11080. note    Interrupts 80h through 0ECh are apparently unused and not initialized
  11081.         in most clone systems. Not known if GWBASIC or MBASIC use any of these
  11082.         interrupts.
  11083.  
  11084.  
  11085. ┌─────────────────────────────────────────────────────────────────────────────┐
  11086. │Interrupt 80h   Novell Netware 2.0 .................................... 5**  │
  11087. └─────────────────────────────────────────────────────────────────────────────┘
  11088.  
  11089.  
  11090. ┌─────────────────────────────────────────────────────────────────────────────┐
  11091. │Interrupt 81h   Novell Netware 2.0 .................................... 5**  │
  11092. └─────────────────────────────────────────────────────────────────────────────┘
  11093.  
  11094.  
  11095. ┌─────────────────────────────────────────────────────────────────────────────┐
  11096. │Interrupt 82h   Reserved by BASIC ..................................... 5**  │
  11097. └─────────────────────────────────────────────────────────────────────────────┘
  11098. note 1) Used in some early versions of NEC Multispeed laptop for ROM
  11099.         application management.
  11100.      2) Used by Pecan Software's Pascal compiler (P-system).
  11101.  
  11102.  
  11103. ┌─────────────────────────────────────────────────────────────────────────────┐
  11104. │Interrupt 81h   Used by Proteon Network ............................... 5**  │
  11105. └─────────────────────────────────────────────────────────────────────────────┘
  11106.  
  11107.  
  11108. ┌─────────────────────────────────────────────────────────────────────────────┐
  11109. │Interrupt 86h   Int 18 when relocated by NETBIOS ...................... 5**84│
  11110. └─────────────────────────────────────────────────────────────────────────────┘
  11111.  
  11112.  
  11113. ┌─────────────────────────────────────────────────────────────────────────────┐
  11114. │Interrupt 86h-0F0h  Used by BASIC when BASIC interpreter is running ... 5**85│
  11115. └─────────────────────────────────────────────────────────────────────────────┘
  11116.  
  11117.  
  11118. ┌─────────────────────────────────────────────────────────────────────────────┐
  11119. │Interrupt 0A0h-0D0h  TI Professional - free interrupt pool ............ 5**  │
  11120. └─────────────────────────────────────────────────────────────────────────────┘
  11121.  
  11122.  
  11123. ┌─────────────────────────────────────────────────────────────────────────────┐
  11124. │Interrupt 0A4h  Right Hand Man API .................................... 5**86│
  11125. └─────────────────────────────────────────────────────────────────────────────┘
  11126. entry   AH      RHM function  (unknown)
  11127. return  unknown
  11128. note    Right-Hand Man is a shareware TSR desktop utility similar to SideKick.
  11129.  
  11130.  
  11131. ┌─────────────────────────────────────────────────────────────────────────────┐
  11132. │Interrupt  0D4h PC-MOS/386 API ........................................ 5**87│
  11133. └─────────────────────────────────────────────────────────────────────────────┘
  11134. note    This interrupt is used for access to the PC-MOS/386 4.x operating
  11135.         system's user API. Previous versions of the OS used interrupt 38h.
  11136.         See Chapter 13 for API programming information.
  11137.  
  11138.  
  11139. ┌─────────────────────────────────────────────────────────────────────────────┐
  11140. │Interrupt  0E0h Digital Research CP/M-86 function calls ............... 5**88│
  11141. └─────────────────────────────────────────────────────────────────────────────┘
  11142. note 1) Lotus 123 Release 2 reportedly alters the int 0E0h vector during
  11143.         operation and leaves it pointing somewhere in the TPA on exit.
  11144.         Perhaps used by the mysterious Lotus add-on program hook?
  11145.      2) Used by Digital Research CP/M-86, Concurrent CP/M and Concurrent DOS
  11146.         API entry points. Values are typicall passed in the DX register and
  11147.         returned in the AX register.
  11148.      3) Used by Larry Himes PD TBACK background timeslicer for DOS. (very old)
  11149.      4) Used by American Data Technology SmartFAX products.
  11150. entry   AH      20h     Send FAX
  11151.         AL      02h     for FAX format file
  11152.                 03h     for ASCII format file
  11153.         CH      number of redials (0-9). Defaults to 9 if input out of range.
  11154.         CL      backoff time (1-99). 1 unit is 15 sec, value is set to 99
  11155.                 if out of range
  11156.         DS:DX   input filename (ASCII). 20 bytes max.
  11157.         DX:BX   dial number. Speed dial number is allowed
  11158. return  AL      (if bit 7 set)  number of files transmitted
  11159.                 (bit 7 not set) 0FFh    file not found
  11160.                                 0FEh    no dial tone
  11161.                                 0FDh    line busy or non-FAX tone
  11162.                                 0FCh    other error
  11163. entry   AH      21h     reserved
  11164.  
  11165. entry   AH      22h     Auto/Manual Transmission Toggle
  11166.         AL      00h     switch to Auto mode (default)
  11167.                 01h     switch to Manual mode
  11168. return  none
  11169.  
  11170. entry   AH      23h     Set Manual Receive Mode
  11171.         AL      00h     switch to Auto mode (default)
  11172.                 01h     switch to Manual mode. SmartFAX will not answer phone
  11173. return  none
  11174.  
  11175. entry   AH      24h     Send FAX Handshake to Remote
  11176. note    No other parameters are necessary. No returns.
  11177.  
  11178. entry   AH      25h     Enable/Disable Background Task for Spooling
  11179.         AL      00h     enabled background operation. Program will put the
  11180.                         received data in the 80188 to spool.
  11181.                 01h     disables background operation. Does not spool data.
  11182.                         Data can be recovered by fns 26h and 27h.
  11183. return  none
  11184.  
  11185. entry   AH      26h     Check 80188 Buffer
  11186.         AX      data length
  11187.         BL      00h     some data of the same page appears in the next buffer
  11188.                 01h     end of page, more to follow
  11189.                 02h     end of page, last page
  11190.  
  11191. entry   AH      27h     Get Data from 80188 Buffer
  11192.         DS:DX   pointer to buffer to be saved, minimum size 12Kb.
  11193. return  AX      data length
  11194.         BL      00h     some data of the same page appears in the next buffer
  11195.                 01h     end of page, more to follow
  11196.                 02h     end of page, last page
  11197.  
  11198. entry   AH      28h     Reset After Receive
  11199. note    Resets SmartFAX for next call. No other parameters.
  11200.  
  11201. entry   AH      29h     Enable/Disable Communication Function
  11202.         AL      00h     enable communication
  11203.                 01h     disable communication
  11204. note    In disable mode, SmartFAX will not send or receive.
  11205.  
  11206.  
  11207. ┌─────────────────────────────────────────────────────────────────────────────┐
  11208. │Interrupt  0E1h PC Cluster Program .................................... 5**89│
  11209. └─────────────────────────────────────────────────────────────────────────────┘
  11210. note    This is a pointer to the disk server data table.
  11211.  
  11212.  
  11213. ┌─────────────────────────────────────────────────────────────────────────────┐
  11214. │Interrupt  0E2h PC Cluster Program .................................... 5**90│
  11215. └─────────────────────────────────────────────────────────────────────────────┘
  11216. note    Interrupt 1Ch is revectored to here.
  11217.  
  11218.  
  11219. ┌─────────────────────────────────────────────────────────────────────────────┐
  11220. │Interrupt 0E4h  Logitech Modula-2 v2.0   Monitor Entry ................ 5**91│
  11221. └─────────────────────────────────────────────────────────────────────────────┘
  11222. entry   AX      05h     monitor entry
  11223.                 06h     monitor exit
  11224.         BX      priority
  11225. return  unknown
  11226.  
  11227.  
  11228. ┌─────────────────────────────────────────────────────────────────────────────┐
  11229. │Interrupt 0E5h  Not Used .............................................. 5**92│
  11230. └─────────────────────────────────────────────────────────────────────────────┘
  11231.  
  11232.  
  11233. ┌─────────────────────────────────────────────────────────────────────────────┐
  11234. │Interrupt 0E6h  Not Used .............................................. 5**93│
  11235. └─────────────────────────────────────────────────────────────────────────────┘
  11236. note    Used by PKzip file compressor.
  11237.  
  11238.  
  11239. ┌─────────────────────────────────────────────────────────────────────────────┐
  11240. │Interrupt 0E7h  Not Used .............................................. 5**94│
  11241. └─────────────────────────────────────────────────────────────────────────────┘
  11242.  
  11243.  
  11244. ┌─────────────────────────────────────────────────────────────────────────────┐
  11245. │Interrupt 0E8h  Not Used .............................................. 5**95│
  11246. └─────────────────────────────────────────────────────────────────────────────┘
  11247.  
  11248.  
  11249. ┌─────────────────────────────────────────────────────────────────────────────┐
  11250. │Interrupt 0E9h  Not Used .............................................. 5**96│
  11251. └─────────────────────────────────────────────────────────────────────────────┘
  11252.  
  11253.  
  11254. ┌─────────────────────────────────────────────────────────────────────────────┐
  11255. │Interrupt 0EAh  Not Used .............................................. 5**97│
  11256. └─────────────────────────────────────────────────────────────────────────────┘
  11257.  
  11258.  
  11259. ┌─────────────────────────────────────────────────────────────────────────────┐
  11260. │Interrupt 0EBh  Not Used .............................................. 5**98│
  11261. └─────────────────────────────────────────────────────────────────────────────┘
  11262.  
  11263.  
  11264. ┌─────────────────────────────────────────────────────────────────────────────┐
  11265. │Interrupt 0ECh  Not Used .............................................. 5**99│
  11266. └─────────────────────────────────────────────────────────────────────────────┘
  11267.  
  11268.  
  11269. ┌─────────────────────────────────────────────────────────────────────────────┐
  11270. │Interrupt 0EDh  Not Used ............................................. 5**100│
  11271. └─────────────────────────────────────────────────────────────────────────────┘
  11272.  
  11273.  
  11274. ┌─────────────────────────────────────────────────────────────────────────────┐
  11275. │Interrupt 0EEh  Not Used ............................................. 5**101│
  11276. └─────────────────────────────────────────────────────────────────────────────┘
  11277.  
  11278.  
  11279. ┌─────────────────────────────────────────────────────────────────────────────┐
  11280. │Interrupt 0EFh  GEM interface (Digital Research) ..................... 5**102│
  11281. └─────────────────────────────────────────────────────────────────────────────┘
  11282. entry   CX      0473h
  11283.         DS:DX   pointer to GEM parameter block
  11284. note    no other parameters are known
  11285.  
  11286.  
  11287. ┌─────────────────────────────────────────────────────────────────────────────┐
  11288. │Interrupt 0F0h  unknown .............................................. 5**103│
  11289. └─────────────────────────────────────────────────────────────────────────────┘
  11290. note    1) Used by secondary copy of COMMAND when SHELL= set.
  11291.         2) Not used by COMMAND /C at DOS prompt.
  11292.         3) Used by BASIC while in interpreter.
  11293.  
  11294.  
  11295. ┌─────────────────────────────────────────────────────────────────────────────┐
  11296. │Interrupts 0F1h-0FFh  (absolute addresses 3C4h-3FFh) ................. 5**104│
  11297. └─────────────────────────────────────────────────────────────────────────────┘
  11298. note    Location of Interprocess Communications Area.
  11299.  
  11300.  
  11301. ┌─────────────────────────────────────────────────────────────────────────────┐
  11302. │Interrupt 0F4h  Not Used ............ ................................ 5**105│
  11303. └─────────────────────────────────────────────────────────────────────────────┘
  11304.  
  11305.  
  11306. ┌─────────────────────────────────────────────────────────────────────────────┐
  11307. │Interrupt 0F5h  Not Used ............ ................................ 5**106│
  11308. └─────────────────────────────────────────────────────────────────────────────┘
  11309.  
  11310.  
  11311. ┌─────────────────────────────────────────────────────────────────────────────┐
  11312. │Interrupt 0F8h  Set Shell Interrupt (OEM) ............................ 5**107│
  11313. └─────────────────────────────────────────────────────────────────────────────┘
  11314.                 Set OEM handler for int 21h calls from 0F9h through 0FFh
  11315. entry   AH      0F8h
  11316.         DS:DX   pointer to handler for Functions 0F9h thru 0FFh
  11317. note 1) To reset these calls, pass DS and DX with 0FFFFh. DOS is set up to
  11318.         allow ONE handler for all 7 of these calls. Any call to these handlers
  11319.         will result in the carry bit being set and AX will contain 1 if they are
  11320.         not initialized. The handling routine is passed all registers just as
  11321.         the user set them. The OEM handler routine should be exited through an
  11322.         IRET.
  11323.      2) 10 ms interval timer (Tandy?)
  11324.  
  11325.  
  11326. ┌─────────────────────────────────────────────────────────────────────────────┐
  11327. │Interrupt 0F9h  Reserved ............................................. 5**108│
  11328. └─────────────────────────────────────────────────────────────────────────────┘
  11329. note    First of 8 SHELL service codes, reserved for OEM shell (WINDOW); use
  11330.         like HP Vectra user interface?
  11331.  
  11332.  
  11333. ┌─────────────────────────────────────────────────────────────────────────────┐
  11334. │Interrupt 0FAh  USART ready (RS-232C) ................................ 5**109│
  11335. └─────────────────────────────────────────────────────────────────────────────┘
  11336.  
  11337.  
  11338. ┌─────────────────────────────────────────────────────────────────────────────┐
  11339. │Interrupt 0FBh  USART RS ready (keyboard) ............................ 5**110│
  11340. └─────────────────────────────────────────────────────────────────────────────┘
  11341.  
  11342.  
  11343. ┌─────────────────────────────────────────────────────────────────────────────┐
  11344. │Interrupt 0FCh  Unknown ...............................................5**111│
  11345. └─────────────────────────────────────────────────────────────────────────────┘
  11346.  
  11347.  
  11348. ┌─────────────────────────────────────────────────────────────────────────────┐
  11349. │Interrupt 0FDh  reserved for user interrupt .......................... 5**112│
  11350. └─────────────────────────────────────────────────────────────────────────────┘
  11351.  
  11352.  
  11353. ┌─────────────────────────────────────────────────────────────────────────────┐
  11354. │Interrupt 0FEh  reserved by IBM ...................................... 5**113│
  11355. └─────────────────────────────────────────────────────────────────────────────┘
  11356. note    AT/XT286/PS50+ - vector destroyed by return from protected mode.
  11357.  
  11358.  
  11359. ┌─────────────────────────────────────────────────────────────────────────────┐
  11360. │Interrupt 0FFh  reserved by IBM ...................................... 5**114│
  11361. └─────────────────────────────────────────────────────────────────────────────┘
  11362. note 1) AT/XT286/PS50+ - vector destroyed by return from protected mode.
  11363.      2) Zenith Z-100 (S-100 bus MSDOS) warm boot.
  11364.  
  11365.  
  11366.  
  11367.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  11368.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  11369. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  11370.                      ISBN 1-878830-02-3 (disk-based text)
  11371.                     Copyright (c) 1987, 1992 Dave Williams
  11372.                         ┌─────────────────────────────┐
  11373.                         │ Shareware Version, 03/16/92 │
  11374.                         │  Please Register Your Copy  │
  11375.                         └─────────────────────────────┘
  11376.  
  11377.  
  11378.                              C H A P T E R   S I X
  11379.  
  11380.                        DOS CONTROL BLOCKS AND WORK AREAS
  11381.  
  11382.  
  11383.  Contrary to popular belief, DOS is not limited to 640k of work space. This 
  11384. constraint is enforced by the mapping of ROM and video RAM into the default 1 
  11385. megabyte CPU address space. Some MSDOS compatible machines, such as the Sanyo 
  11386. 55x series, can have as much as 768k of contiguous DOS workspace with the 
  11387. appropriate option boards. Since DOS has no real memory management, it cannot 
  11388. deal with a fragmented workspace. Fragmented RAM (such as RAM mapped into the 
  11389. option ROM address space) can be dealt with as a RAMdisk or other storage area 
  11390. by using a device driver or other software.
  11391.  
  11392.  The 80386 CPU and appropriate control software can create a DOS workspace of 
  11393. more than one megabyte. Certain add-on boards can also add more than a 
  11394. megabyte of workspace, but only for specially written software. Since these 
  11395. are all proprietary schemes, little information is availible at present.
  11396.  
  11397.  When DOS loads a program, it first sets aside a section of memory for the 
  11398. program called the program segment, or code segment. Then it constructs a 
  11399. control block called the program segment prefix, or PSP, in the first 256 
  11400. (100h) bytes. Usually, the program is loaded directly after the PSP at 100h.
  11401.  The PSP contains various information used by DOS to help run the program.  
  11402. The PSP is always located at offset 0 within the code segment. When a program 
  11403. recieves control certain registers are set to point to the PSP. For a COM 
  11404. file, all registers are set to point to the beginning of the PSP and the 
  11405. program begins at 100h. For the more complex EXE file structures, only DS and 
  11406. ES registers are set to point to the PSP. The linker passes the settings for 
  11407. the DS, IP, SS, and SP registers and may set the starting location in CS:IP to 
  11408. a location other than 100h.
  11409.  
  11410.  IBMBIO provides an IRET instruction at absolute address 847h for use as a 
  11411. dummy routine for interrupts that are not used by DOS. This lets the interrupts
  11412. do nothing until their vectors are rerouted to their appropriate handlers.
  11413.  
  11414.  A storage block is used by DOS to record the amount and location of allocated 
  11415. memory within the machine's address space.
  11416.  A storage block, a Program Segment Prefix, and an environment area are built 
  11417. by DOS for each program currently resident in the address space. The storage 
  11418. block is used by DOS to record the address range of memory allocated to a 
  11419. program. It is used by DOS to find the next availible area to load a program 
  11420. and to determine if there is enough memory to run that porogram. When a 
  11421. memory area is in use, it is said to be allocated. Then the program ends, or 
  11422. releases memory, it is said to be deallocated. 
  11423.  A storage block contains a pointer to the Program Segment Prefix associated 
  11424. with each program. This control block is constructed by IBMDOS for the purpose 
  11425. of providing standardized areas for DOS/program communication. Within the 
  11426. PSP are areas which  are used to save interrupt vectors, pass parameters to 
  11427. the program, record disk directory information, and to buffer disk reads and 
  11428. writes. This control block is 100h bytes in length and is followed by the 
  11429. program module loaded by DOS. 
  11430.  The PSP contains a pointer to the environment area for that program. This 
  11431. area contains a copy of the current DOS SET, PROMPT, COMSPEC, and PATH values 
  11432. as well as any user-set variables. The program may examine and modify this 
  11433. information as desired. 
  11434.  Each storage block is 10h bytes long, although only 5 bytes are currently 
  11435. used by DOS. The first byte contains 4Dh (a capital M) to indicate that it 
  11436. contains a pointer to the next storage block. A 5Ah (a capital Z) in the 
  11437. first byte of a storage block indicatres there are no more storage blocks 
  11438. following this one (it is the end of the chain). The identifier byte is 
  11439. followed by a 2 byte segment number for the associated PSP for that program. 
  11440. The next 2 bytes contain the number of segments what are allocated to the 
  11441. program. If this is not the last storage block, then another storage block 
  11442. follows the allocated memory area.
  11443.  When the storage block contains zero for the number of allocated segments, 
  11444. then no storage is allocated to this block and the next storage block 
  11445. immediately follows this one. This can happen when memory is allocated and 
  11446. then deallocated repeatedly.
  11447.  IBMDOS constructs a storage block and PSP before loading the command 
  11448. interpreter (default is COMMAND.COM).
  11449.  
  11450.  If the copy of COMMAND.COM is a secondary copy, it will lack an environment 
  11451. address at PSP+2Ch.
  11452.  
  11453.  
  11454.  
  11455. THE DISK TRANSFER AREA (DTA)├──────────────────────────────────────────────────
  11456.  
  11457.  DOS uses an area in memory to contain the data for all file reads and writes 
  11458. that are performed with FCB function calls. This are is known as the disk 
  11459. transfer area. This disk transfer area (DTA) is sometimes called a buffer. 
  11460. It can be located anywhere in the data area of your application program and 
  11461. should be set by your program.
  11462.  
  11463.  Only one DTA can be in effect at a time, so your program must tell DOS what 
  11464. memory location to use before using any disk read or write functions. Use 
  11465. function call 1Ah (Set Disk Transfer Address) to set the disk transfer address.
  11466. Use function call 2Fh (Get Disk Transfer Address) to get the disk transfer 
  11467. address. Once set, DOS continues to use that area for all disk operations until
  11468. another function call 1Ah is issued to define a new DTA. When a program is given
  11469. control by COMMAND.COM, a default DTA large enough to hold 128 bytes is 
  11470. established at 80h into the program's Program Segment Prefix.
  11471.  
  11472.  For file reads and writes that are performed with the extended function calls,
  11473. there is no need to set a DTA address. Instead, specify a buffer address when 
  11474. you issue the read or write call.
  11475.  
  11476.  
  11477. DOS PROGRAM SEGMENT├───────────────────────────────────────────────────────────
  11478.  
  11479.  When you enter an external command or call a program through the EXEC function 
  11480. call, DOS determines the lowest availible address space to use as the start of 
  11481. available memory for the program being started. This area is called the Program
  11482. Segment.
  11483.  At offset 0 within the program segment, DOS builds the Program Segment Prefix 
  11484. control block. EXEC loads the program after the Program Segment Prefix (at
  11485. offset 100h) and gives it control.
  11486.  The program returns from EXEC by a jump to offset 0 in the Program Segment 
  11487. Prefix, by issuing an int 20h, or by issuing an int 21h with register AH=00h or 
  11488. 4Ch, or by calling location 50h in the PSP with AH=00h or 4Ch.
  11489.  It is the responsibility of all programs to ensure that the CS register 
  11490. contains the segment address of the Program Segment Prefix when terminating by
  11491. any of these methods except call 4Ch.
  11492.  
  11493.  All of these methods result in returning to the program that issued the EXEC. 
  11494. During this returning process, interrupt vectors 22h, 23h, and 24h (Terminate, 
  11495. Ctrl-Break, and Critical Error Exit addresses) are restored from the values 
  11496. saved in the PSP of the terminating program. Control is then given to the 
  11497. terminate address.
  11498.  
  11499.  
  11500. When a program receives control, the following conditions are in effect:
  11501.  
  11502. For all programs:
  11503.  
  11504. 1) The segment address of the passed environment is contained at offset 2Ch in 
  11505.    the Program Segment Prefix.
  11506.  
  11507. 2) The environment is a series of ASCII strings totalling less than 32k bytes
  11508.    in the form:       NAME=value      The default environment is 160 bytes.
  11509.     Each string is a maximum of 127 bytes terminated by a byte of zeroes for a 
  11510.    total of 128 bytes, and the entire set of strings is terminated by another
  11511.    byte of zeroes. Following the byte of zeroes that terminates the set of
  11512.    environment string is a set of initial arguments passed to a program that
  11513.    contains a word count followed by an ASCIIZ string. The ASCIIZ string
  11514.    contains the drive, path, and filename.ext of the executable program.
  11515.    Programs may use this area to determine where the program was loaded from.
  11516.    The environment built by the command processor (and passed to all programs
  11517.    it invokes) contains a COMSPEC=string at a minimum (the parameter on COMSPEC
  11518.    is the path used by DOS to locate COMMAND.COM on disk). The last PATH and
  11519.    PROMPT commands issued will also be in the environment, along with any 
  11520.    environment strings entered through the SET command. 
  11521.     The environment that you are passed is actually a copy of the invoking 
  11522.    process's environment. If your application terminates and stays resident 
  11523.    through int 27h, you should be aware that the copy of the environment passed 
  11524.    to you is static. That is, it will not change even if subsequent PATH,
  11525.    PROMPT, or SET commands are issued.
  11526.     The size of the environment may be changed from its default of 160 bytes
  11527.    by using the SHELL= command in the config.sys from in DOS version 3.1 up,
  11528.    or COMMAND.COM may be patched in earlier versions.
  11529.  
  11530.    The environment can be used to transfer information between processes or to
  11531.    store strings for later use by application programs. The environment is
  11532.    always located on a paragraph boundary. This is its format:
  11533.         byte    ASCIIZ string 1
  11534.         byte    ASCIIZ string 2
  11535.             ....
  11536.         byte    ASCIIZ string n
  11537.         byte    of zeros (0)
  11538.    Typically the environment strings have the form:
  11539.         NAME = VALUE
  11540.    The length of NAME or VALUE can be anything desired as long as it still fits
  11541.    into the 123 byte space (4 bytes are used by "SET ").
  11542.    Following the byte of zeros in the environment, a WORD indicates the number 
  11543.    of other strings following. 
  11544.  
  11545.    If the environment is part of an EXECed command interpreter, it is followed 
  11546.    by a copy of the DS:DX filename passed to the child process. A zero value 
  11547.    causes the newly created process to inherit the parent's environment.
  11548.  
  11549. 3) Offset 80h in the PSP contains code to invoke the DOS function dispatcher.
  11550.    Thus, by placing the desired function number in AH, a program can issue a
  11551.    long call to PSP+50h to invoke a DOS function rather than issuing an int 21h.
  11552.  
  11553. 4) The disk transfer address (DTA) is set to 80h (default DTA in PSP).
  11554.  
  11555. 5) File Control Blocks 5Ch and 6Ch are formatted from the first two parameters 
  11556.    entered when the command was invoked. Note that if either parameter contained
  11557.    a path name, then the corresponding FCB will contain only a valid drive
  11558.    number. The filename field will not be valid.
  11559.  
  11560. 6) An unformatted parameter area at 81h contains all the characters entered
  11561.    after the command name (including leading and imbedded delimiters), with 80h
  11562.    set to the number of characters. If the <, >, or | parameters were entered
  11563.    on the command line, they (and the filenames associated with them) will not
  11564.    appear in this area, because redirection of standard input and output is
  11565.    transparent to applications.
  11566.  
  11567. (For EXE files only)
  11568. 7) DS and ES registers are set to point to the PSP.
  11569.  
  11570. 8) CS, IP, SS, and SP registers are set to the values passed by the linker.
  11571.  
  11572. (For COM files only)
  11573. 9) For COM files, offset 6 (one word) contains the number of bytes availible in 
  11574.    the segment.
  11575.  
  11576. 10) Register AX reflects the validity of drive specifiers entered with the
  11577.     first two parameters as follows:
  11578.         AL=0FFh is the first parameter contained an invalid drive specifier,
  11579.                 otherwise AL=00h.
  11580.         AL=0FFh if the second parameter contained an invalid drive specifier, 
  11581.                 otherwise AL=00h.
  11582.  
  11583. 11) All four segment registers contain the segment address of the inital 
  11584.     allocation block, that starts within the PSP control block. All of user
  11585.     memory is allocated to the program. If the program needs to invoke another
  11586.     program through the EXEC function call (4Bh), it must first free some memory
  11587.     through the SETBLOCK function call to provide space for the program being
  11588.     invoked.
  11589.  
  11590. 12) The Instruction Pointer (IP) is set to 100h.
  11591.  
  11592. 13) The SP register is set to the end of the program's segment. The segment size
  11593.     at offset 6 is rounded down to the paragraph size.
  11594.  
  11595. 14) A word of zeroes is placed on top of the stack.
  11596.  
  11597.  
  11598.  The PSP (with offsets in hexadecimal) is formatted as follows:
  11599.  (* = undocumented)
  11600.  
  11601. ┌──────────────────────────────────────────────────────────────────────────────┐
  11602. │     P  R  O  G  R  A  M       S  E  G  M  E  N  T       P  R  E  F  I  X     │
  11603. ├───────┬──────────┬───────────────────────────────────────────────────────────┤
  11604. │ offset│   size   │                     C O N T E N T S                       │
  11605. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11606. │ 0000h │ 2 bytes  │ int 20h                                                   │
  11607. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11608. │ 0002h │ 2 bytes  │ segment address, end of allocation block                  │
  11609. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11610. │ 0004h │ 1 byte   │ reserved, normally 0                                      │
  11611. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11612. │ 0005h │ 5 bytes  │ FAR call to MSDOS function dispatcher (int 21h)           │
  11613. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11614. │ 000Ah │ 4 bytes  │ previous termination handler interrupt vector (int 22h)   │
  11615. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11616. │ 000Eh │ 4 bytes  │ previous contents of ctrl-C interrupt vector (int 23h)    │
  11617. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11618. │ 0012h │ 4 bytes  │ prev. critical error handler interrupt vector (int 24h)   │
  11619. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11620. │ 0016h │ 22 bytes │ reserved for DOS                                          │
  11621. └───────┼──────────┼───────────────────────────────────────────────────────────┤
  11622.       * │ 2 bytes  │ (16) parent process' PSP                                  │
  11623.       * │ 20 bytes │ (18) "handle table" used for redirection of files         │
  11624. ┌───────┼──────────┼───────────────────────────────────────────────────────────┤
  11625. │ 002Ch │ 2 bytes  │ segment address of the program's environment block        │
  11626. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11627. │ 002Eh │ 34 bytes │ reserved, DOS work area                                   │
  11628. └───────┼──────────┼───────────────────────────────────────────────────────────┤
  11629.       * │  4 bytes │ (2E) stores the calling process's stack pointer when      │
  11630.         │          │      switching to DOS's internal stack.                   │
  11631.       * │          │ (32) DOS 3.x max open files                               │
  11632.       * │  2 bytes │ (3A) size of handle table   |these functions are in here  │
  11633.       * │  4 bytes │ (3C) handle table address   |but reported addresses vary  │
  11634. ┌───────┼──────────┼───────────────────────────────────────────────────────────┤
  11635. │ 0050h │  3 bytes │ int 21h, RETF instruction                                 │
  11636. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11637. │ 0053h │  2 bytes │ reserved - unused?                                        │
  11638. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11639. │ 0055h │  7 bytes │ reserved, or FCB#1 extension                              │
  11640. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11641. │ 005Ch │ 16 bytes │ default unopened File Control Block #1                    │
  11642. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11643. │ 006Ch │ 16 bytes │ default unopened FCB #2 (overlaid if FCB #1 opened)       │
  11644. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11645. │ 0080h │  1 byte  │ parameter length (number of chars entered after filename) │
  11646. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11647. │ 0081h │   ...    │ parameters                                                │
  11648. ├───────┼──────────┼───────────────────────────────────────────────────────────┤
  11649. │ 00FFh │ 128 bytes│ command tail and default Disk Transfer Area (DTA)         │
  11650. └───────┴──────────┴───────────────────────────────────────────────────────────┘
  11651.  
  11652.  
  11653. 1. The first segment of availible memory is in segment (paragraph) form. For 
  11654.    example, 1000h would respresent 64k.
  11655.  
  11656. 2. Offset 2Ch contains the segment address of the environment.
  11657.  
  11658. 3. Programs must not alter any part of the PSP below offset 5Ch.
  11659.  
  11660.  
  11661. PSP (comments):
  11662.  
  11663. offset 00h  contains hex bytes CD 20, the int 20h opcode. A program can end
  11664.             by making a jump to this location when the CS points to the PSP.
  11665.             For normal cases, int 21, function 4Ch should be used.
  11666.  
  11667. offset 02h  contains the segment-paragraph address of the end of memory as 
  11668.             reported by DOS. (which may not be the same as the real end of RAM).
  11669.             Multiply this number by 10h or 16 to get the amount of memory
  11670.             availible. ex. 1000h would be 64k.
  11671.  
  11672. offset 04h  "reserved or used by DOS" according to Microsoft
  11673.  
  11674. offset 05h  contains a long call to the DOS function dispatcher. Programs may 
  11675.             jump to this address instead of calling int 21 if they wish. 
  11676.             Used by Basic and other CPM object-code translated programs. It is
  11677.             slower than standard int 21h.
  11678.  
  11679. offset 0Ah, 0Eh, 12h
  11680.             vectors (IP, CS)
  11681.  
  11682. offset 16h  PSP:16h is the segment address of the invoking program's PSP, which
  11683.         *   will most often be COMMAND.COM but perhaps may be a secondary
  11684.             non-permanent COMMAND or a multitasking shell, etc. At any rate,
  11685.             the resident shell version of COMMAND.COM has PSP:16H = PSP, which
  11686.             indicates "don't look any lower in memory" for the command
  11687.             interpreter. To find the beginning of the allocation chain, look
  11688.             backwards through the PSP link addresses until the link address is
  11689.             equal to the PSP segment address that it resides in. This should
  11690.             be COMMAND.COM. To find COMMAND.COM's environment, look at the word
  11691.             stored at offset 0BD3h (PC-DOS 3.1 only). This is a segment
  11692.             address, so look there at offset 0.
  11693.  
  11694.        18h  handle alias table (networking). Also you can make PRN go to CON,
  11695.         *   CON go to PRN, ERR go to PRN, etc. 0FFh = availible.
  11696.  
  11697. offset 2Ch  is the segment:offset address of the environment for the program 
  11698.             using this particular PSP. This pointer does not point to
  11699.             COMMAND.COM's environment unless it is a second copy of COMMAND.
  11700.  
  11701. offset 2Eh  the DWORD at PSP+2Eh is used by DOS to store the calling process's
  11702.         *   stack pointer when switching to DOS's own private stack - at the end
  11703.             of a DOS function call, SS:SP is restored from this address.
  11704.  
  11705.        32h, 34h
  11706.         *   table of number of file handles (to 64k of handles!)
  11707.  
  11708. offset 40h  2 byte field points to the segment address of COMMAND.COM's PSP in
  11709.         *   "weird" EXE files produced by Digital Research RASMPC/LINKPC.
  11710.             EXE files created with these tools can cause all sorts of problems
  11711.             with standard MSDOS debugging tools.
  11712.  
  11713. offset 50h  contains a long call to the DOS int 21 function dispatcher.
  11714.  
  11715. offset 5Ch, 65h, 6Ch
  11716.             contain FCB information for use with FCB function calls. The first
  11717.             FCB may overlay the second if it is an extended call; your program
  11718.             should revector these areas to a safe place if you intend to use
  11719.             them.
  11720.  
  11721. offset 5Ch  16 bytes first command-line argument (formatted as uppercase 11
  11722.             character filename)
  11723.  
  11724. offset 6Ch  16 bytes second command-line argument (formatted as uppercase 11
  11725.             character filename)
  11726.  
  11727. offset 7Ch-7Fh
  11728.            "reserved or used by DOS"
  11729. offset 80h  1 byte number of bytes in command line argument
  11730.  
  11731. offset 80h, 81h
  11732.             contain the length and value of parameters passed on the command
  11733.             line. 
  11734.  
  11735. offset 81h  97 bytes unformatted command line and/or default DTA
  11736.  
  11737. offset 0FFh contains the DTA
  11738.           
  11739.  
  11740.  The PSP is created by DOS for all programs and contains most of the information
  11741. you need to know about a program running. You can change the environment for
  11742. the current process, however, but for the parent process, DOS in this case, you
  11743. need to literally backtrack to DOS or COMMAND.COM's PSP. In order to get there
  11744. you must look at the current PSP. At offset 16h of the current PSP segment,
  11745. there a 2 byte segment address to the parent or previous process PSP.
  11746.  From there you can manipulate the enviroment by looking at offset 2Ch. As you
  11747. know, at offset 2Ch, there is 2 byte segment address to the environment block.
  11748.  
  11749. Try this under debug and explore the addresses located at these offsets;
  11750.  
  11751.       offset  length                description
  11752.      ------------------------------------------------------------
  11753.         16h     2       segment address of parent process PSP
  11754.         2Ch     2       segment address of environment block.
  11755.  
  11756. Remember under debug you will have to backtrack two times.
  11757.  
  11758.         Programs        Parent
  11759.       --------------------------
  11760.         command.com     none
  11761.         debug.com       command.com
  11762.         program         debug.com
  11763.  
  11764.  
  11765.  
  11766.  
  11767. MEMORY CONTROL BLOCKS├─────────────────────────────────────────────────────────
  11768.  
  11769.  DOS keeps track of allocated and availible memory blocks, and provides four
  11770. function calls for application programs to communicate their memory needs to 
  11771. DOS. These calls are:
  11772.               48h --- allocate memory                 (MALLOC)
  11773.               49h --- free allocated memory
  11774.               4Ah --- modify allocated memory blocks  (SETBLOCK)
  11775.               4Bh --- load or execute program         (EXEC)
  11776.  
  11777. DOS manages memory as follows:
  11778.  
  11779.  DOS build a control block for each block of memory, whether free or allocated.
  11780. For example, if a program issues an "allocate" (48h), DOS locates a block of
  11781. free memory that satisfies the request, and then "carves" the requested memory 
  11782. out of that block. The requesting program is passed the location of the first 
  11783. byte of the block that was allocated for it - a memory management control block,
  11784. describing the allocated block, has been built for the allocated block and a 
  11785. second memory management control block describes the amount of space left in the
  11786. original free block of memory. When you do a SETBLOCK to shrink an allocated 
  11787. block, DOS builds a memory management control block for the area being freed and
  11788. adds it to the chain of control blocks. Thus, any program that changed memory 
  11789. that is not allocated to it stands a chance of destroying a DOS memory 
  11790. management control block. This causes unpredictable results that don't show up 
  11791. until an activity is performed where DOS uses its chain of control blocks. The 
  11792. normal result is a memory allocation error, which means a system reset will be 
  11793. required.
  11794.  
  11795.  When a program (command or application program) is to be loaded, DOS uses the 
  11796. EXEC function call 4Bh to perform the loading.
  11797.  
  11798.  This is the same function call that is availible to applications programs for 
  11799. loading other programs. This function call has two options:
  11800.  
  11801.       Function 00h, to load and execute a program (this is what the command
  11802.                     processor uses to load and execute external commands)
  11803.  
  11804.       Function 03h, to load an overlay (program) without executing it.
  11805.  
  11806.  Although both functions perform their loading in the same way (relocation is 
  11807. performed for EXE files) their handling of memory management is different.
  11808.  
  11809. FUNCTION 0: For function 0 to load and execute a program, EXEC first allocates 
  11810. the largest availible block of memory (the new program's PSP will be at offset 
  11811. 0 in that block). Then EXEC loads the program. Thus, in most cases, the new 
  11812. program owns all the memory from its PSP to the end of memory, including memory
  11813. occupied by the transient parent of COMMAND.COM. If the program were to issue 
  11814. its own EXEC function call to load and execute another program, the request 
  11815. would fail because no availible memory exists to load the new program into.
  11816.  
  11817. NOTE: For EXE programs, the amount of memory allocated is the size of the 
  11818.       program's memory image plus the value in the MAX_ALLOC field of the file's
  11819.       header (offset 0Ch, if that much memory is availible. If not, EXEC 
  11820.       allocates the size of the program's memory image plus the value in the 
  11821.       MIN_ALLOC field in the header (offset 0Ah). These fields are set by the 
  11822.       Linker).
  11823.  
  11824.  A well-behaved program uses the SETBLOCK function call when it receives 
  11825. control, to shrink its allocated memory block down to the size it really needs.
  11826. A COM program should remember to set up its own stack before doing the SETBLOCK,
  11827. since it is likely that the default stack supplied by DOS lies in the area of 
  11828. memory being used. This frees unneeded memory, which can be used for loading 
  11829. other programs.
  11830.  
  11831.  If the program requires additional memory during processing, it can obtain 
  11832. the memory using the allocate function call and later free it using the free 
  11833. memory function call.
  11834.  
  11835.  When a program is loaded using EXEC function call 00h exits, its initial 
  11836. allocation block (the block beginning with its PSP) is automatically freed 
  11837. before the calling program regains control. It is the responsibility of all 
  11838. programs to free any memory they allocate before exiting to the calling 
  11839. program.
  11840.  
  11841.  FUNCTION 3: For function 3, to load an overlay, no PSP is built and EXEC 
  11842. assumes the calling program has already allocated memory to load the new program
  11843. into - it will NOT allocate memory for it. Thus the calling program should 
  11844. either allow for the loading of overlays when it determines the amount of memory
  11845. to keep when issuing the SETBLOCK call, or should initially free as much memory 
  11846. as possible. The calling program should then allocate a block (based on the size
  11847. of the program to be loaded) to hold the program that will be loaded using the 
  11848. "load overlay" call. Note that "load overlay" does not check to see if the 
  11849. calling program actually owns the memory block it has been instructed to load 
  11850. into - it assumes the calling program has followed the rules. If the calling 
  11851. program does not own the memory into which the overlay is being loaded, there is
  11852. a chance the program being loaded will overlay one of the control blocks that 
  11853. DOS uses to keep track of memory blocks.
  11854.  
  11855.  Programs loaded using function 3 should not issue any SETBLOCK calls since
  11856. they don't own the memory they are operating in. (This memory is owned by the
  11857. calling program)
  11858.  
  11859.  Because programs loaded using function 3 are given control directly by (and 
  11860. return contrrol directly to) the calling program, no memory is automatically 
  11861. freed when the called program exits. It is up to the calling program to 
  11862. determine the disposition of the memory that had been occupied by the exiting 
  11863. program. Note that if the exiting program had itself allocated any memory, it 
  11864. is responsible for freeing that memory before exiting.
  11865.  
  11866.  Memory control blocks, sometimes called "arena headers" after their UNIX 
  11867. counterpart, are 16 bytes long. Only the first 5 bytes are used. 16 bytes are
  11868. used for the memory control block, which always starts at a paragraph boundary.
  11869. When DOS call 48h is made to allocate "x" many paragraphs of memory, the amount
  11870. used up is actually one more than the figure in the BX register to provide
  11871. space for the associated memory control block. The location of the memory
  11872. control block is at the paragraph immediately before the segment value returned
  11873. in AX by the DOS function 48h call i.e. ((AX-1):0).
  11874.  
  11875. ┌──────────────────────────────────────────────────────────────────────────────┐
  11876. │               M E M O R Y      C O N T R O L       B L O C K                 │
  11877. ├───────┬──────────────────────────────────────────────────────────────────────┤
  11878. │ Bytes │                           Function                                   │
  11879. ├───────┼──────────────────────────────────────────────────────────────────────┤
  11880. │   0   │ ASCII M or Z                                                         │
  11881. ├───────┼──────────────────────────────────────────────────────────────────────┤
  11882. │  1-2  │ PSP segment address of the program that owns this block of memory    │
  11883. ├───────┼──────────────────────────────────────────────────────────────────────┤
  11884. │  3-4  │ Size of next MCB in 16-byte paragraphs                               │
  11885. ├───────┼──────────────────────────────────────────────────────────────────────┤
  11886. │  5-F  │ unused                                                               │
  11887. └───────┴──────────────────────────────────────────────────────────────────────┘
  11888.  
  11889. byte 1    will always have the value of 4Dh or 5Ah. The value 5Ah (Z) indicates
  11890.           the block is the last in a chain, all memory above it is unused. 4Dh
  11891.           (M) means that the block is intermediate in a chain, the memory above
  11892.           it belongs to the next program or to DOS.
  11893.  
  11894. byte 2,3  hold the PSP segment address of the program that owns the
  11895.           corresponding block of memory. A value of 0 means the block is free
  11896.           to be claimed, any other value represents a segment address.
  11897.  
  11898. byte 3, 4 indicate the size in paragraphs of the memory block. If you know the
  11899.           address of the first block, you can find the next block by adding the
  11900.           length of the memory block plus 1 to the segment address of the
  11901.           control block. Finding the first block can be difficult, as this
  11902.           varies according to the DOS version and the configuration. 
  11903.  
  11904.  The remaining 11 bytes are not currently used by DOS, and may contain "trash" 
  11905. characters left in memory from previous applications.
  11906.  
  11907.  If DOS determines that the allocation chain of memory control blocks has been 
  11908. corrupted, it will halt the system and display the message "Memory Allocation 
  11909. Error", and the system will halt, requiring a reboot.
  11910.  
  11911.  Each memory block consists of a signature byte (4Dh or 5Ah) then a word which
  11912. is the PSP value of the owner of the block (which allocated it), followed by a 
  11913. word which is the size in paragraphs of the block. The last block has a 
  11914. signature of 5Ah. All others have 4Dh. If the owner is 0000 then the block is 
  11915. free.
  11916.  
  11917.  Once a memory control block has been created it should only be manipulated
  11918. with the appropriate DOS function calls. Accidentally writing over any of the
  11919. first 5 bytes of a memory control block can cause a memory allocation error 
  11920. and cause the system to lock up. If the first byte is overwritten with
  11921. something other than an 'M' or a 'Z' then DOS will complain with an error
  11922. return code of 7 signifying "Memory Control Blocks destroyed". However, should
  11923. you change the ownership or block size bytes, you've had it.
  11924.  
  11925.  When a .COM program is first loaded by DOS and given control, the memory
  11926. control block immediately preceding the Program Segment Prefix contains the
  11927. following data:
  11928.  
  11929.           ID    = 'Z'
  11930.           Owner = segment address of PSP (= CS register of .COM program)
  11931.           Size  = number of available paragraphs in DOS memory pool
  11932.  
  11933.   An .EXE file will have the following data in the memory control block for
  11934. the program (just prior to the PSP):
  11935.  
  11936.           ID    = 'M'
  11937.           Owner = segment address of PSP (= DS register of program)
  11938.           Size  = the number of paragraphs allocated to the program according
  11939.                   to the information in the .EXE program header
  11940.  
  11941.  In the case of an .EXE program file the amount of memory allocated depends
  11942. on the contents of the program header which informs the DOS loader how much to
  11943. allocate for each of the segments in the program. With an .EXE program file
  11944. there will always be a 'Z' memory control block created in memory immediately
  11945. after the end of the space allocated to the program itself.
  11946.  
  11947.  One important fact to remember about DOS memory allocation is that blocks of
  11948. RAM allocated by different calls to DOS function 48H will NOT be contiguous. At
  11949. the very best, they will be separated by the 16 bytes of the memory control
  11950. block, and at worst they could be anywhere in RAM that DOS manages to find a
  11951. existing memory control block of sufficient size to accomodate the memory
  11952. request.
  11953.  
  11954.  DOS treats the memory control blocks as a kind of linked list (term used
  11955. loosely). It uses the earlier MCBs to find the later ones by calculating the
  11956. location of the next one from the size of the prior one. As such, erasing any
  11957. of the MCB data in the chain of MCBs will upset DOS severely, as each call for
  11958. a new memory allocation causes DOS to scan the whole chain of MCBs looking for
  11959. a free one that is large enough to fulfill the request.
  11960.  
  11961.  A separate MCB is created for the DOS environment strings at each program
  11962. load, so there will be many copies of the environment strewn through memory
  11963. when you have a lot of memory resident programs loaded. The memory control
  11964. blocks for the DOS environment strings are not returned to the DOS memory pool
  11965. if the program goes resident, as DOS will need to copy this enviroment for the
  11966. next program loaded.
  11967.  
  11968.  
  11969.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  11970.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  11971. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  11972.                      ISBN 1-878830-02-3 (disk-based text)
  11973.                     Copyright (c) 1987, 1992 Dave Williams
  11974.                         ┌─────────────────────────────┐
  11975.                         │ Shareware Version, 03/16/92 │
  11976.                         │  Please Register Your Copy  │
  11977.                         └─────────────────────────────┘
  11978.  
  11979.  
  11980.                            C H A P T E R   S E V E N
  11981.  
  11982.                               DOS FILE STRUCTURE
  11983.  
  11984.  
  11985.  
  11986. FILE MANAGEMENT FUNCTIONS├─────────────────────────────────────────────────────
  11987.  
  11988.  Use DOS function calls to create, open, close, read, write, rename, find, and 
  11989. erase files. There are two sets of function calls that DOS provides for support
  11990. of file management. They are:
  11991.  
  11992.    * File Control Block function calls   (0Fh-24h)
  11993.    * Handle function calls               (39h-69h)
  11994.  
  11995.  Handle function calls are easier to use and are more powerful than FCB calls.
  11996. Microsoft recommends that the handle function calls be used when writing new
  11997. programs. DOS 3.0 up have been curtailing use of FCB function calls; it is
  11998. possible that future versions of DOS may not support FCB function calls.
  11999.  
  12000.  The following table compares the use of FCB calls to Handle function calls:
  12001.  
  12002.    ┌──────────────────────────────┬─────────────────────────────────────────┐
  12003.    │           FCB Calls          │               Handle Calls              │
  12004.    ├──────────────────────────────┼─────────────────────────────────────────┤
  12005.    │  Access files in current     │  Access files in ANY directory          │
  12006.    │  directory only.             │                                         │
  12007.    │                              │                                         │
  12008.    │  Requires the application    │  Does not require use of an FCB.        │
  12009.    │  program to maintain a file  │  Requires a string with the drive,      │
  12010.    │  control block to open,      │  path, and filename to open, create,    │
  12011.    │  create, rename or delete    │  rename, or delete a file. For file     │
  12012.    │  a file. For I/O requests,   │  I/O requests, the application program  │
  12013.    │  the application program     │  must maintain a 16 bit file handle     │
  12014.    │  also needs an FCB           │  that is supplied by DOS.               │
  12015.    └──────────────────────────────┴─────────────────────────────────────────┘
  12016.  
  12017.  The only reason an application should use FCB function calls is to maintain
  12018. the ability to run under DOS 1.x. To to this, the program may use only function
  12019. calls 00h-2Eh. Though the FCB function calls are frowned upon, many of the 
  12020. introductory assembly language programming texts use the FCB calls as examples.
  12021.  
  12022.  
  12023.  
  12024. FCB FUNCTION CALLS ├───────────────────────────────────────────────────────────
  12025.  
  12026.  FCB function calls require the use of one File Control Block per open file, 
  12027. which is maintained by the application program and DOS. The application program
  12028. supplies a pointer to the FCB and fills in ther appropriate fields required by 
  12029. the specific function call. An FCB function call can perform file management on
  12030. any valid drive, but only in the current logged directory. By using the current
  12031. block, current record, and record length fields of the FCB, you can perform 
  12032. sequential I/O by using the sequential read or write function calls. Random I/O
  12033. can be performed by filling in the random record and record length fields. 
  12034.  
  12035.  Several possible uses of FCB type calls are considered programming errors and 
  12036. should not be done under any circumstances to avoid problems with file sharing
  12037. and compatibility with later versions of DOS.
  12038.  Some errors are:
  12039. 1) If program uses the same FCB structure to access more than one open file. By
  12040.    opening a file using an FCB, doing I/O, and then replacing the filename field
  12041.    in the file control block with a new filename, a program can open a second
  12042.    file using the same FCB. This is invalid because DOS writes control info-
  12043.    rmation about the file into the reserved fields of the FCB. If the program
  12044.    then replaces the filename field with the original filename and then tries to
  12045.    perform I/O on this file, DOS may become confused because the control info-
  12046.    rmation has been changed. An FCB should never be used to open a second file
  12047.    without closing the one that is currently open. If more than one File Control
  12048.    Block is to be open concurrently, separate FCBs should be used.
  12049.  
  12050. 2) A program should never try to use the reserved fields in the FCB, as the
  12051.    function of the fields changes with different versions of DOS.
  12052.  
  12053. 3) A delete or a rename on a file that is currently open is considered an error
  12054.    and should not be attempted by an application program.
  12055.  
  12056.  It is also good programming practice to close all files when I/O is done. This
  12057. avoids potential file sharing problems that require a limit on the number of
  12058. files concurrently open using FCB function calls.
  12059.  
  12060.  
  12061.  
  12062. HANDLE FUNCTION CALLS├─────────────────────────────────────────────────────────
  12063.  
  12064.  The recommended method of file management is by using the extended "handle" 
  12065. set of function calls. These calls are not restricted to the current directory.
  12066. Also, the handle calls allow the application program to define the type of 
  12067. access that other processes can have concurrently with the same file if the file
  12068. is being shared.
  12069.  
  12070.  To create or open a file, the application supplies a pointer to an ASCIIZ 
  12071. string giving the name and location of the file. The ASCIIZ string contains an 
  12072. optional drive letter, optional path, mandatory file specification, and a 
  12073. terminal byte of 00h. The following is an example of an ASCIIZ string:
  12074.  
  12075.                   format [drive][path] filename.ext,0
  12076.  
  12077.                       DB "A:\path\filename.ext",0
  12078.  
  12079.  If the file is being created, the application program also supplies the 
  12080. attribute of the file. This is a set of values that defines the file read 
  12081. only, hidden, system, directory, or volume label.
  12082.  
  12083.  If the file is being opened, the program can define the sharing and access 
  12084. modes that the file is opened in. The access mode informs DOS what operations 
  12085. your program will perform on this file (read-only, write-only, or read/write) 
  12086. The sharing mode controls the type of operations other processes may perform 
  12087. concurrently on the file. A program can also control if a child process inherits
  12088. the open files of the parent. The sharing mode has meaning only if file sharing
  12089. is loaded when the file is opened.
  12090.  
  12091.  To rename or delete a file, the appplication program simply needs to provide 
  12092. a pointer to the ASCIIZ string containing the name and location of the file 
  12093. and another string with the new name if the file is being renamed.
  12094.  
  12095.  The open or create function calls return a 16-bit value referred to as the 
  12096. file handle. To do any I/O to a file, the program uses the handle to reference
  12097. the file. Once a file is opened, a program no longer needs to maintain the 
  12098. ASCIIZ string pointing to the file, nor is there any need to stay in the same 
  12099. directory. DOS keeps track of the location of the file regardless of what 
  12100. directory is current.
  12101.  
  12102.  Sequential I/O can be performed using the handle read (3Fh) or write (40h) 
  12103. function calls. The offset in the file that IO is performed to is automatically
  12104. moved to the end of what was just read or written. If random I/O is desired, the
  12105. LSEEK (42h) function call can be used to set the offset into the file where I/O 
  12106. is to be performed.
  12107.  
  12108.  
  12109. SPECIAL FILE HANDLES├──────────────────────────────────────────────────────────
  12110.  
  12111.  DOS reserves five special file handles for use by itself and applications 
  12112. programs. They are:
  12113. ┌───────┬────────┬─────────────────────────────────────────────────────────────┐
  12114. │ 0000h │ STDIN  │ standard input device        (input can be redirected)      │
  12115. │ 0001h │ STDOUT │ standard output device       (output can be redirected)     │
  12116. │ 0002h │ STDERR │ standard error output device (output cannot be redirected)  │
  12117. │ 0004h │ STDAUX │ standard auxiliary device                                   │
  12118. │ 0005h │ STDPRN │ standard printer device                                     │
  12119. └───────┴────────┴─────────────────────────────────────────────────────────────┘
  12120.  
  12121.  These handles are predefined by DOS and can be used by an application program.
  12122. They do not need to be opened by a program, although a program can close these 
  12123. handles. STDIN should be treated as a read-only file, and STDOUT and STDERR 
  12124. should be treated as write-only files. STDIN and STDOUT can be redirected. All 
  12125. handles inherited by a process can be redirected, but not at the command line.
  12126.  These handles are very useful for doing I/O to and from the console device. 
  12127. For example, you could read input from the keyboard using the read (3Fh) 
  12128. function call and file handle 0000h (STDIN), and write output to the console 
  12129. screen with the write function call (40h) and file handle 0001h (STDOUT). If 
  12130. you wanted an output that could not be redirected, you could output it using 
  12131. file handle 0002h (STDERR). This is very useful for error messages that must 
  12132. be seen by a user.
  12133.  
  12134.  File handles 0003h (STDAUX) and 0004h (STDPRN) can be both read from and 
  12135. written to. STDAUX is typically a serial device and STDPRN is usually a parallel
  12136. device.
  12137.  
  12138.  
  12139. ASCII and BINARY MODE├─────────────────────────────────────────────────────────
  12140.  
  12141.  I/O to files is done in binary mode. This means that the data is read or 
  12142. written without modification. However, DOS can also read or write to devices in
  12143. ASCII mode. In ASCII mode, DOS does some string processing and modification to 
  12144. the characters read and written. The predefined handles are in ASCII mode when 
  12145. initialized by DOS. All other file handles that don't refer to devices are in 
  12146. binary mode. A program, can use the IOCTL (44h) function call to set the mode 
  12147. that I/O is to a device. The predefined file handles are all devices, so the 
  12148. mode can be changed from ASCII to binary via IOCTL. Regular file handles that 
  12149. are not devices are always in binary mode and cannot be changed to ASCII mode.
  12150.  
  12151.  The ASCII/BINARY bit was called "raw" in DOS 2.x, but it is called ASCII/BINARY
  12152. in DOS 3.x.
  12153.  
  12154.  The predefined file handles STDIN (0000h) and STDOUT (0001h) and STDERR 
  12155. (0002h) are all duplicate handles. If the IOCTL function call is used to change
  12156. the mode of any of these three handles, the mode of all three handles is 
  12157. changed. For example, if IOCTL was used to change STDOUT to binary mode, then 
  12158. STDIN and STDERR would also be changed to binary mode.
  12159.  
  12160.  
  12161.  
  12162. FILE I/O IN BINARY (RAW) MODE├─────────────────────────────────────────────────
  12163.  
  12164. The following is true when a file is read in binary mode:
  12165.  
  12166. 1)  The characters ^S (scroll lock), ^P (print screen), ^C (control break) are 
  12167.     not checked for during the read. Therefore, no printer echo occurs if ^S or
  12168.     ^P are read.
  12169. 2)  There is no echo to STDOUT (0001h).
  12170. 3)  Read the number of specified bytes and returns immediately when the last 
  12171.     byte is received or the end of file reached.
  12172. 4)  Allows no editing of the ine input using the function keys if the input is 
  12173.     from STDIN (0000h).
  12174.  
  12175.  
  12176. The following is true when a file is written to in binary mode:
  12177.  
  12178. 1)  The characters ^S (scroll lock), ^P (print screen), ^C (control break) are 
  12179.     not checked for during the write. Therefore, no printer echo occurs.
  12180. 2)  There is no echo to STDOUT (0001h).
  12181. 3)  The exact number of bytes specified are written.
  12182. 4)  Does not caret (^) control characters. For example, ctrl-D is sent out as 
  12183.     byte 04h instead of the two bytes ^ and D.
  12184. 5)  Does not expand tabs into spaces. 
  12185.  
  12186.  
  12187. FILE I/O IN ASCII (COOKED) MODE├───────────────────────────────────────────────
  12188.  
  12189. The following is true when a file is read in ASCII mode:
  12190.  
  12191. 1)  Checks for the characters ^C,^S, and ^P.
  12192. 2)  Returns as many characters as there are in the device input buffer, or the 
  12193.     number of characters requested, whichever is less. If the number of 
  12194.     characters requested was less than the number of characters in the device 
  12195.     buffer, then the next read will address the remaining characters in the 
  12196.     buffer.
  12197. 3)  If there are no more bytes remaining in the device input buffer, read a 
  12198.     line (terminated by ^M) into the buffer. This line may be edited with the 
  12199.     function keys. The characters returned terminated with a sequence of 0Dh,
  12200.     0Ah (^M,^J) if the number of characters requested is sufficient to include
  12201.     them. For example, if 5 characters were requested, and only 3 were entered
  12202.     before the carriage return (0Dh or ^M) was presented to DOS from the console
  12203.     device, then the 3 characters entered and 0Dh and 0Ah would be returned. 
  12204.     However, if 5 characters were requested and 7 were entered before the 
  12205.     carriage return, only the first 5 characters would be returned. No 0Dh,0Ah 
  12206.     sequence would be returned in this case. If less than the number of 
  12207.     characters requested are entered when the carriage return is received, the
  12208.     characters received and 0Dh,0Ah would be returned. The reason the 0Ah 
  12209.     (linefeed or ^J) is added to the returned characters is to make the devices
  12210.     look like text files.
  12211. 4)  If a 1Ah (^Z) is found, the input is terminated at that point. No 0Dh,0Ah 
  12212.     (CR,LF) sequence is added to the string.
  12213. 5)  Echoing is performed.
  12214. 6)  Tabs are expanded.
  12215.  
  12216.  
  12217. The following is true when a file is written to in ASCII mode:
  12218.  
  12219. 1)  The characters ^S,^P,and ^C are checked for during the write operation.
  12220. 2)  Expands tabs to 8-character boundaries and fills with spaces (20h).
  12221. 3)  Carets control characters, for example, ^D is written as two bytes, ^ and D.
  12222. 4)  Bytes are output until the number specified is output or a ^Z is 
  12223.     encountered. The number actually output is returned to the user.
  12224.  
  12225.  
  12226. NUMBER OF OPEN FILES ALLOWED├──────────────────────────────────────────────────
  12227.  
  12228.  The number of files that can be open concurrently is restricted by DOS. This 
  12229. number is determined by how the file is opened or created (FCB or handle 
  12230. function call) and the number specified by the FCBS and FILES commands in the 
  12231. CONFIG.SYS file. The number of files allowed open by FCB function calls and the
  12232. number of files that can be opened by handle type calls are independent of one 
  12233. another.
  12234.  
  12235.  
  12236. RESTRICTIONS ON FCB USAGE├─────────────────────────────────────────────────────
  12237.  
  12238.  If file sharing is not loaded using the SHARE command, there are no 
  12239. restrictions on the nuumber of files concurrently open using FCB function calls.
  12240.  
  12241.  However, when file sharing is loaded, the maximum number of FCBs open is set
  12242. by the the FCBS command in the CONFIG.SYS file.
  12243.  
  12244.  The FCBS command has two values you can specify, 'm' and 'n'. The value for 
  12245. 'm' specifies the number of files that can be opened by FCBs, and the value 'n' 
  12246. specifies the number of FCBs that are protected from being closed.
  12247.  
  12248.  When the maximum number of FCB opens is exceeded, DOS automatically closes the
  12249. least recently used file. Any attempt to access this file results in an int 24h
  12250. critical error message "FCB not availible". If this occurs while an application
  12251. program is running, the value specified for 'm' in the FCBS command should be
  12252. increased.
  12253.  
  12254.  When DOS determines the least recently used file to close, it does not include
  12255. the first 'n' files opened, therefore the first 'n' files are protected from 
  12256. being closed.
  12257.  
  12258.  
  12259. RESTRICTIONS ON HANDLE USAGE├──────────────────────────────────────────────────
  12260.  
  12261.  The number of files that can be open simultaneously by all processes is 
  12262. determined by the FILES command in the CONFIG.SYS file. The number of files a 
  12263. single process can open depends on the value specified for the FILES command. If
  12264. FILES is greater than or equal to 20, a single process can open 20 files. If 
  12265. FILES is less than 20, the process can open less than 20 files. This value 
  12266. includes three predefined handles: STDIN, STDOUT, and STDERR. This means only
  12267. 17 additional handles can be added. DOS 3.3 includes a function to use more than
  12268. 20 files per application.
  12269.  
  12270.  
  12271. ALLOCATING SPACE TO A FILE├────────────────────────────────────────────────────
  12272.  
  12273.  Files are not nescessarily written sequentially on a disk. Space is allocated 
  12274. as needed and the next location availible on the disk is allocated as space for
  12275. the next file being written. Therefore, if considerable file generation has
  12276. taken place, newly created files will not be written in sequential sectors.
  12277. However, due to the mapping (chaining) of file space via the File Allocation
  12278. Table (FAT) and the function calls availible, any file may be used in either a
  12279. sequential or random manner.
  12280.  
  12281.  Space is allocated in increments called clusters. Cluster size varies 
  12282. according to the media type. An application program should not concern itself 
  12283. with the way that DOS allocates space to a file. The size of a cluster is only 
  12284. important in that it determines the smallest amount of space that can be 
  12285. allocated to a file. A disk is considered full when all clusters have been 
  12286. allocated to files.
  12287.  
  12288.  
  12289.  
  12290. MSDOS / PCDOS DIFFERENCES├─────────────────────────────────────────────────────
  12291.  
  12292.  There is a problem of compatibility between MS-DOS and IBM PC-DOS having to 
  12293. do with FCB Open and Create. The IBM 1.0, 1.1, and 2.0 documentation of OPEN
  12294. (call 0Fh) contains the following statement:
  12295.  
  12296.  "The current block field (FCB bytes C-D) is set to zero [when an FCB is 
  12297. opened]."
  12298.  
  12299.  This statement is NOT true of MS-DOS 1.25 or MS-DOS 2.00. The difference is
  12300. intentional, and the reason is CP/M 1.4 compatibility. Zeroing that field is 
  12301. not CP/M compatible. Some CP/M programs will not run when machine translated if
  12302. that field is zeroed. The reason it is zeroed in the IBM versions is that IBM 
  12303. specifically requested that it be zeroed. This is the reason for the complaints
  12304. from some vendors about the fact that IBM MultiPlan will not run under MS-DOS.
  12305. It is probably the reason that some other IBM programs don't run under MS-DOS.
  12306.  
  12307. NOTE: Do what all MS/PC-DOS systems programs do: Set every single FCB field you
  12308. want to use regardless of what the documentation says is initialized.
  12309.  
  12310.  
  12311. .COM FILE STRUCTURE├───────────────────────────────────────────────────────────
  12312.  
  12313.  The COM file structure was designed for DOS 1.0 and maximum compatibility 
  12314. with programs ported from the CP/M operating system. COM files normally 
  12315. comprise one segment only.
  12316.  
  12317.  
  12318. .EXE FILE STRUCTURE├───────────────────────────────────────────────────────────
  12319.  
  12320.  The EXE file is the native mode for DOS. EXE files may make use of multiple 
  12321. segments for code, stack, and data. The design of the EXE file reflects the 
  12322. segmented design of the Intel 80x86 CPU architecture. EXE files may be as 
  12323. large as availible memory and may make references to specific segment addresses.
  12324.  
  12325.  
  12326.  The EXE files produced by the Linker program consist of two parts, control and
  12327. relocation information and the load module itself.
  12328.  
  12329.  The control and relocation information, which is described below, is at the 
  12330. beginning of the file in an area known as the header. The load module 
  12331. immediately follows the header. The load module begins in the memory image of 
  12332. the module contructed by the Linker.
  12333.  
  12334.  When you are loading a file with the name *.EXE, DOS does NOT assume that it
  12335. is an EXE format file. It looks at the first two bytes for a signature telling
  12336. it that it is an EXE file. If it has the proper signature, then the load 
  12337. proceeds. Otherwise, it presumes the file to be a .COM format file.
  12338.  
  12339.  If the file has the EXE signature, then the internal consistency is checked.
  12340. Pre-2.0 versions of MSDOS did not check the signature byte for EXE files.
  12341.  
  12342.  The .EXE format can support programs larger than 64K. It does this by 
  12343. allowing separate segments to be defined for code, data, and the stack, each 
  12344. of which can be up to 64K long. Programs in EXE format may contain explicit 
  12345. references to segment addresses. A header in the EXE file has information for 
  12346. DOS to resolve these references.
  12347.  
  12348.  
  12349. The .EXE header is formatted as follows:
  12350. ┌─────────┬───────────────────────────────────────────────────────────────────┐
  12351. │ Offset  │                      C O N T E N T S                              │
  12352. ├─────────┼─────┬─────────────────────────────────────────────────────────────┤
  12353. │   00h   │ 4Dh │ This is the Linker's signature to mark the file as a valid  │ 
  12354. ├─────────┼─────┤ .EXE file  (The ASCII letters M and Z, for Mark Zbikowski,  │
  12355. │   01h   │ 5Ah │ one of the major designers of DOS at Microsoft)             │
  12356. ├─────────┼─────┴─────────────────────────────────────────────────────────────┤
  12357. │ 02h-03h │ Length of the image mod 512 (remainder after dividing the load    │
  12358. │         │ module image size by 512)                                         │
  12359. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12360. │ 04h-05h │ Size of the file in 512 byte pages including the header.          │ 
  12361. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12362. │ 06h-07h │ Number of relocation table items following the header.            │
  12363. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12364. │ 08h-09h │ Size of the header in 16 byte increments (paragraphs). This is    │
  12365. │         │ used to locate the beginning of the load module in the file.      │
  12366. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12367. │ 0Ah-0Bh │ Minimum number of 16 byte paragraphs required above the end of    │
  12368. │         │ the loaded program.                                               │
  12369. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12370. │ 0Ch-0Dh │ Maximum number of 16 byte paragraphs required above the end of    │
  12371. │         │ the loaded program. If the minimum and maximum number of          │
  12372. │         │ paragraphs are both zero, the program will be loaded as high in   │
  12373. │         │ memory as possible.                                               │
  12374. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12375. │ 0Eh-0Fh │ Displacement in paragraphs of stack segment within load module.   │
  12376. │         │ This size must be adjusted by relocation.                         │
  12377. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12378. │ 10h-11h │ Offset to be in SP register when the module is given control.     │
  12379. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12380. │ 12h-13h │ Word Checksum - negative sum of all the words in the file,        │
  12381. │         │ ignoring overflow.                                                │
  12382. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12383. │ 14h-15h │ Offset to be in the IP register when the module is given control. │
  12384. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12385. │ 16h-17h │ Displacement in paragraphs of code segment within load module.    │
  12386. │         │ This size must be adjusted by relocation.                         │
  12387. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12388. │ 18h-19h │ Displacement in bytes of the first relocation item in the file.   │
  12389. ├─────────┼───────────────────────────────────────────────────────────────────┤
  12390. │ 1Ah-1Bh │ Overlay number (0 for the resident part of the program)           │
  12391. └─────────┴───────────────────────────────────────────────────────────────────┘
  12392.  
  12393.  
  12394.  
  12395. THE RELOCATION TABLE├──────────────────────────────────────────────────────────
  12396.  
  12397.  The word at 18h locates the first entry in the relocation table. The 
  12398. relocation table is made up of a variable number of relocation items. The number
  12399. of items is contained at offset 06-07. The relocation item contains two fields
  12400. - a 2 byte offset value, followed by a 2 byte segment value. These two fields 
  12401. represent the displacement into the load module before the module is given 
  12402. control. The process is called relocation and is accomplished as follows:
  12403.  
  12404. 1. The formatted part of the header is read into memory. Its size is 1Bh.
  12405.  
  12406. 2. A portion of memory is allocated depending on the size of the load module
  12407.    and the allocation numbers in offsets 0Ah-0Ch and 0Ch-0Dh. DOS always
  12408.    tries to allocate 0FFFFh paragraphs. Since this call will always fail,
  12409.    the function returns the amount of free memory. If this block is larger
  12410.    than the minimum specified at offset 0Ah and the loaded program size,
  12411.    DOS will allocate the size specified at offset 0Ch or the largest free
  12412.    memory space, whichever is less.
  12413.  
  12414. 3. A Program Segment Prefix is built following the resident portion of the 
  12415.    program that is performing the load operation.
  12416.  
  12417. 4. The formatted part of the header is read into memory (its size is at 
  12418.    offset 08h)
  12419.  
  12420. 5. The load module size is determined by subtracting the header size from the 
  12421.    file size. Offsets 04h and 08h can be used for this calculation. The 
  12422.    actual size is downward adjusted based on the contents of offsets 02-03. 
  12423.    Note that all files created by the Linker programs prior to version 1.10 
  12424.    always placed a value of 4 at this location, regardless of the actual 
  12425.    program size. Therefore, Microsoft recommends that this field be ignored if 
  12426.    it contains a value of 4. Based on the setting of the high/low loader switch,
  12427.    an appropriate segment is determined for loading the load module. This
  12428.    segment is called the start segment.
  12429.  
  12430. 6. The load module is read into memory beginning at the start segment. The
  12431.    relocation table is an ordered list of relocation items. The first relocation
  12432.    item is the one that has the lowest offset in the file. 
  12433.  
  12434. 7. The relocation table items are read into a work area one or more at a time.
  12435.  
  12436. 8. Each relocation table item segment value is added to the start segment value.
  12437.    The calculated segment, in conjunction with the relocation item offset value,
  12438.    points to a word in the load module to which is added the start segment 
  12439.    value. The result is placed back into the word in the load module.
  12440.  
  12441. 9. Once all the relocation items have been processed, the SS and SP registers 
  12442.    are set from the values in the header and the start segment value is added 
  12443.    to SS. The ES and DS registers are set to the segment address of the program 
  12444.    segment prefix. The start segment value is added to the header CS register 
  12445.    value. The result, along with the header IP value, is used to give the 
  12446.    module control.
  12447.  
  12448.  
  12449. "NEW" .EXE FORMAT (Microsoft Windows and OS/2)├────────────────────────────────
  12450.  
  12451.  The "old" EXE format is documented here. The "new" EXE format puts more 
  12452. information into the header section and is currently used in applications that 
  12453. run under Microsoft Windows. The linker that creates these files comes with the 
  12454. Microsoft Windows Software Development Kit and is called LINK4. If you try to 
  12455. run a Windows-linked program under DOS, you will get the error message "This 
  12456. program requires Microsoft Windows".
  12457.  
  12458. PIF Files
  12459.   PIF stands for "Program Information File". The PIF format was developed by 
  12460. IBM for use with TopView, its multitasking manager. Microsoft also uses PIF 
  12461. files to pass information regarding the amount of memory and type of I/O a 
  12462. program running under Microsoft Windows requires.
  12463.   The actual internal format of the PIF files is documented in the IBM TopView 
  12464. Programmers' ToolKit.
  12465.  
  12466. STANDRD FILE CONTROL BLOCK├────────────────────────────────────────────────────
  12467.  
  12468.  The standard file control block is defined as follows, with offsets in hex:
  12469.  
  12470. ┌──────────────────────────────────────────────────────────────────────────────┐
  12471. │                 F I L E      C O N T R O L      B L O C K                    │
  12472. ├───────┬──────────────────────────────────────────────────────────────────────┤
  12473. │ Bytes │                           Function                                   │
  12474. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12475. │   0   │ 1 byte Drive number. For example:                                    │
  12476. │       │ Before open:    00h = default drive                                  │
  12477. │       │                 01h = drive A:                                       │
  12478. │       │                 02h = drive B: etc.                                  │
  12479. │       │ After open:     00h = drive C:                                       │
  12480. │       │                 01h = drive A:                                       │
  12481. │       │                 02h = drive B: etc.                                  │
  12482. │       │ An 0 is replaced by the actual drive number during open.             │
  12483. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12484. │  1-8  │ 8 bytes Filename, left justified with blanks. If a reserved device   │
  12485. │       │ name is placed here (such as PRN) do not include the optional colon. │
  12486. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12487. │  9-B  │ 3 bytes Filename extension, left justified with trailing blanks.     │
  12488. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12489. │  C-D  │ 2 bytes Current block # relative to start of file, starting with 0   │
  12490. │       │ (set to 0 by the open function call). A block consists of 128        │
  12491. │       │ records, each of the size specified in the logical record size field.│
  12492. │       │ The current block number is used with the current record field       │
  12493. │       │ (below) for sequential reads and writes.                             │
  12494. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12495. │  E-F  │ 2 bytes Logical record size in bytes. Set to 80h by OPEN function    │
  12496. │       │ If this is not correct, you must set the value because DOS uses it   │
  12497. │       │ to determine the proper locations in the file for all disk reads and │
  12498. │       │ writes.                                                              │
  12499. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12500. │ 10-13 │ 4 bytes File size in bytes. In this field, the first word is the     │
  12501. │       │ low-order part of the size.                                          │
  12502. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12503. │ 14-15 │ 2 bytes Date file was created or last updated. mm/dd/yy are mapped   │
  12504. │       │ as follows:                                                          │
  12505. │       │         15  14  13  12  11  10  9  8  7  6  5  4  3  2  1  0         │
  12506. │       │         y   y   y   y   y   y   y  m  m  m  m  d  d  d  d  d         │
  12507. │       │ where:            mm is 1-12                                         │
  12508. │       │                   dd is 1-31                                         │
  12509. │       │                   yy is 0-119 (1980-2099)                            │
  12510. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12511. │ 16-17 │ 2 bytes time file was created or last updated.                       │
  12512. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12513. │       │ These bytes contain the time when the file was created or last       │
  12514. │       │  updated. The time is mapped in the bits as follows:                 │
  12515. │       ├───────────────────────────────┬───────────────────────────────┐      │
  12516. │       │         B Y T E   16h         │         B Y T E   17h         │      │
  12517. │       ├───────────────────────────────┼───────────────────────────────┤      │
  12518. │       │ F   E   D   C   B   A   9   8 │ 7   6   5   4   3   2   1   0 │      │
  12519. │       ├───────────────────┬───────────┴───────────┬───────────────────┤      │
  12520. │       │ H   H   H   H   H │ M   M   M   M   M   M │ D   D   D   D   D │      │
  12521. │       ├───────────────────┼───────────────────────┼───────────────────┤      │
  12522. │       │ binary # hrs 0-23 │ binary # minutes 0-59 │ bin. # 2-sec incr │      │
  12523. │       ├───────────────────┴───────────────────────┴───────────────────┘      │
  12524. │       │ note: The time is stored with the least significant byte first.      │
  12525. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12526. │ 18-19 │ 2 bytes Reserved for DOS.                                            │
  12527. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12528. │  20   │1 byte  Current relative record number (0-127) within the current     │
  12529. │       │ block. This field and the Current Block field at offset 0Ch make up  │
  12530. │       │ the record pointer. This field is not initialized by the OPEN        │
  12531. │       │ function call. You must set this field before doing sequential read- │
  12532. │       │ write operations to the diskette.                                    │
  12533. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12534. │ 21-25 │ 4 bytes Relative Record. Points to the currently selected record,    │
  12535. │       │ counting from the beginning of the file starting with 0. This field  │
  12536. │       │ is not initialized by the OPEN system call. You must set this field  │
  12537. │       │ before doing a random read or write to the file.                     │
  12538. │       │  If the record size is less than 64 bytes, both words are used.      │
  12539. │       │ Otherwise, only the first 3 bytes are used. Note that if you use the │
  12540. │       │ File Control Block at 5Ch in the program segment, the last byte of   │
  12541. │       │ the FCB overlaps the first byte of the unformatted parameter area.   │
  12542. └───────┴──────────────────────────────────────────────────────────────────────┘
  12543.  
  12544. note 1) An unopened FCB consists of the FCB prefix (if used), drive number, and 
  12545.         filename.ext properly filled in. An open FCB is one in which the 
  12546.         remaining fields have been filled in by the CREAT or OPEN function 
  12547.         calls.
  12548.      2) Bytes 0-5 and 32-36 must be set by the user program. Bytes 16-31 are set
  12549.         by DOS and must not be changed by user programs.
  12550.      3) All word fields are stored with the least significant byte first. For 
  12551.         example, a record length of 128 is stored as 80h at offset 14, and 00h 
  12552.         at offset 15.
  12553.  
  12554.  
  12555.  
  12556. EXTENDED FILE CONTROL BLOCK├───────────────────────────────────────────────────
  12557.  
  12558.  The extended file control block is used to create or search for files in the 
  12559. disk directory that have special attributes.
  12560.  
  12561. It adds a 7 byte prefix to the FCB, formatted as follows:
  12562.  
  12563. ┌──────────────────────────────────────────────────────────────────────────────┐
  12564. │       E X T E N D E D     F I L E      C O N T R O L      B L O C K          │
  12565. ├───────┬──────────────────────────────────────────────────────────────────────┤
  12566. │ Bytes │                           Function                                   │
  12567. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12568. │   0   │ Flag byte containing 0FFh to indicate an extended FCB.               │
  12569. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12570. │  1-6  │ Reserved                                                             │
  12571. ├───────┼──────────────────────────────────────────────────────────────────────┤
  12572. │  6-7  │ Attribute byte. Refer to function call 11h (search first) for        │
  12573. │       │ details on using the attribute bits during directory searches. This  │
  12574. │       │ function is present to allow applications to define their own files  │
  12575. │       │ as hidden (and thereby excluded from normal directory searches) and  │
  12576. │       │ to allow selective directory searches.                               │
  12577. └───────┴──────────────────────────────────────────────────────────────────────┘
  12578.                                      
  12579.  Any reference in the DOS function calls to an FCB, whether opened or unopened,
  12580. may use either a normal or extended FCB. If you are using an extended FCB, the 
  12581. appropriate register should be set to the first byte of the prefix, rather than
  12582. the drive-number field.
  12583.  
  12584.  Common practice is to refer to the extended FCB as a negative offset from the 
  12585. first byte of a standard File Control Block.
  12586.  
  12587.  
  12588.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  12589.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  12590. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  12591.                      ISBN 1-878830-02-3 (disk-based text)
  12592.                     Copyright (c) 1987, 1992 Dave Williams
  12593.                         ┌─────────────────────────────┐
  12594.                         │ Shareware Version, 03/16/92 │
  12595.                         │  Please Register Your Copy  │
  12596.                         └─────────────────────────────┘
  12597.  
  12598.  
  12599.                            C H A P T E R   E I G H T
  12600.  
  12601.  
  12602.                              DOS DISK INFORMATION
  12603.  
  12604.  
  12605.                                 C O N T E N T S
  12606.  
  12607. The DOS Area .......................................................... 8**1
  12608. The Boot Record ....................................................... 8**2
  12609. DOS File Allocation Table (FAT) ....................................... 8**3
  12610.         Media Descriptor Byte ......................................... 8**4
  12611.         12 Bit FATs ................................................... 8**5
  12612.         16 Bit FATs ................................................... 8**6
  12613. DOS Disk Directory .................................................... 8**8
  12614. The Data Area ......................................................... 8**9
  12615. Floppy Disk Types ..................................................... 8**10
  12616. Hard Disk Layout ...................................................... 8**11
  12617. System Initialization ................................................. 8**12
  12618. Boot Record/Partition Table ........................................... 8**13
  12619. Hard Disk Technical Information ....................................... 8**14
  12620. Determining Hard Disk File Allocation ................................. 8**15
  12621. BIOS Disk Functions ................................................... 8**16
  12622.         00h  Reset
  12623.         01h  Get Status
  12624.         02h  Read Sectors
  12625.         03h  Write Sectors
  12626.         04h  Verify
  12627.         05h  Format Track (floppy disk)
  12628.         06h  Hard Disk - format track
  12629.         07h  Hard Disk - format drive
  12630.         08h  Read Drive Parameters
  12631.         09h  Initialize Two Fixed Disk Base Tables
  12632.         0Ah  Read Long (Hard disk)
  12633.         0Bh  Write Long (Hard disk)
  12634.         0Ch  Seek To Cylinder
  12635.         0Dh  Alternate Hard Disk Reset
  12636.         0Eh  Read Sector Buffer
  12637.         0Fh  Write sector buffer
  12638.         10h  Test For Drive Ready
  12639.         11h  Recalibrate Drive
  12640.         12h  Controller RAM Diagnostic
  12641.         13h  Controller Drive Diagnostic
  12642.         14h  Controller Internal Diagnostic
  12643.         15h  Get Disk Type
  12644.         16h  Get Disk Change Status (diskette)
  12645.         17h  Set Disk Type for Format (diskette)
  12646.         18h  Set Media Type For Format (diskette)
  12647.         19h  Park Hard Disk Heads
  12648.         1Ah  ESDI Hard Disk - Low Level Format
  12649.         1Bh  ESDI Hard Disk - Get Manufacturing Header
  12650.         1Ch  ESDI Hard Disk - Get Configuration
  12651.  
  12652.  
  12653.  
  12654.  
  12655. THE DOS AREA├────────────────────────────────────────────────────────── 8**1
  12656.  
  12657.  All disks and diskettes formatted by DOS are created with a sector size of 512
  12658. bytes. The DOS area (entire area for a diskette, DOS partition for hard disks)
  12659. is formatted as follows:
  12660.  
  12661.         ┌────────────────────────────────────────────────────────────┐
  12662.         │                       D O S   A R E A                      │
  12663.         ├────────────────────────────────────────────────────────────┤
  12664.         │ partition table          - variable size (hard disk only)  │
  12665.         │ boot record              - 1 sector                        │
  12666.         │ first copy of the FAT    - variable size                   │
  12667.         │ second copy of the FAT   - same size as first copy         │
  12668.         │ root directory           - variable size                   │
  12669.         │ data area                - variable depending on disk size │
  12670.         └────────────────────────────────────────────────────────────┘
  12671.  
  12672. The following sections describe each of the allocated areas:
  12673.  
  12674.  
  12675.  
  12676. THE BOOT RECORD├─────────────────────────────────────────────────────── 8**2
  12677.  
  12678.  The boot record resides on track 0, sector 1, side 0 of every diskette
  12679. formatted by the DOS FORMAT program. For hard disks the boot record resides on
  12680. the first sector of the DOS partition. It is put on all disks to provide an
  12681. error message if you try to start up with a nonsystem disk in drive A:. If the
  12682. disk is a system disk, the boot record contains a JMP instruction pointing to
  12683. the first byte of the operating system.
  12684.  
  12685.  If the device is IBM compatible the first sector of the first FAT must be
  12686. located at the same sector for all disk types. This is because the FAT sector
  12687. is read before the disk type is actually determined.
  12688.  
  12689.  The information relating to the BPB for a particular media is kept in the 
  12690. disk's boot sector.  The format of the boot sector is:
  12691.  
  12692. ┌──────────────────────────────────────────────────────────────────────────────┐
  12693. │                        D O S   B O O T   R E C O R D                         │
  12694. ├───┬───────┬──────────────────────────────────────────────────────────────────┤
  12695. │00h│3 bytes│  JMP to executable code. For DOS 2.x, 3 byte near jump (0E9h).   │
  12696. │   │       │  For DOS 3.x, 2 byte near jump (0EBh) followed by a NOP (90h)    │
  12697. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  12698. │03h│8 bytes│  optional OEM name and version  (such as IBM 2.1)                │
  12699. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  12700. │0Bh│2 bytes│  bytes per sector                                                │
  12701. ├───┼───────┼─────┬────────────────────────────────────────────────────────────┤
  12702. │0Dh│ byte  │     │  sectors per allocation unit (must be a power of 2)        │
  12703. ├───┼───────┤     ├────────────────────────────────────────────────────────────┤
  12704. │0Eh│2 bytes│  B  │  reserved sectors (starting at logical sector 0)           │
  12705. │   │       │     │  01 for 1.x-3.31, 02 for 4.0+                              │
  12706. ├───┼───────┤     ├────────────────────────────────────────────────────────────┤
  12707. │10h│ byte  │     │  number of FATs                                            │
  12708. ├───┼───────┤     ├────────────────────────────────────────────────────────────┤
  12709. │11h│2 bytes│     │  maximum number of root directory entries                  │
  12710. ├───┼───────┤  P  ├────────────────────────────────────────────────────────────┤
  12711. │13h│2 bytes│     │  number of sectors in logical image (total number of       │
  12712. │   │       │     │  sectors in media, including boot sector directories, etc.)│
  12713. │   │       │     │  If logical disk size is geater than 32Mb, this value is 0 │
  12714. │   │       │     │  and the actual size is reported at offset 26h (DOS 4.0+)  │
  12715. ├───┼───────┤     ├────────────────────────────────────────────────────────────┤
  12716. │15h│ byte  │  B  │  media descriptor byte                                     │
  12717. ├───┼───────┤     ├────────────────────────────────────────────────────────────┤
  12718. │16h│2 bytes│     │  number of sectors occupied by a single FAT                │
  12719. ├───┼───────┼─────┴────────────────────────────────────────────────────────────┤
  12720. │18h│2 bytes│  sectors per track                                               │
  12721. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  12722. │1Ah│2 bytes│  number of heads                                                 │
  12723. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  12724. │1Ch│2 bytes│  # of hidden sectors  (sectors before this volume) (1st part)    │
  12725. └───┴───────┼──────────────────────────────────────────────────────────────────┤
  12726.             │                EXTENDED BOOT RECORD (DOS 4.0+)                   │
  12727. ┌───┬───────┼──────────────────────────────────────────────────────────────────┤
  12728. │1Eh│2 bytes│  # of hidden sectors  (sectors before this volume) (2nd part)    │
  12729. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  12730. │20h│4 bytes│  # sectors in this disk (see offset 13h, if 0)                   │
  12731. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  12732. │24h│2 bytes│  physical drive number (max 2 for DOS 4, max 8 for DOS 5)        │
  12733. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  12734. │26h│ byte  │  extended boot record signature  (29h)                           │
  12735. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  12736. │27h│4 bytes│  volume serial number (assigned with a random function)          │
  12737. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  12738. │2Bh│11 byte│  volume label                                                    │
  12739. ├───┼───────┼──────────────────────────────────────────────────────────────────┤
  12740. │36h│7 bytes│  file system ID   (FAT12   ), (FAT16   ) etc.     ("reserved")   │
  12741. └───┴───────┴──────────────────────────────────────────────────────────────────┘
  12742.  
  12743.  The three words at the end return information about the media. The number of
  12744. heads is useful for supporting different multihead drives that have the same
  12745. storage capacity but a different number of surfaces. The number of hidden
  12746. sectors is useful for drive partitioning schemes.
  12747.  
  12748.  DOS 3.2 uses a table called the BIOS Parameter Block (BPB) to determine if a
  12749. disk has a valid File Allocation Table. The BPB is located in the first sector
  12750. of a floppy disk. Although the BPB is supposed to be on every formatted floppy
  12751. disk, some earlier versions of DOS did not create a BPB and instead assumed that
  12752. the FAT begins at the second sector of the disk and that the first FAT byte
  12753. (Media Descriptor Byte) describes the disk format.
  12754.  DOS 3.2 reads in the whole of the BPB and tries to use it - although strangely
  12755. enough, it seems as if DOS is prepared to cope with a BPB that is more or less
  12756. totally blank (it seems to ignore the descriptor byte and treat it as a DSDD
  12757. 9-sector disk).
  12758.  DOS 3.2 determines if a disk has a valid boot sector by examining the first
  12759. byte of logical sector 0. If that byte it a jump instruction 0E9h, DOS 3.2
  12760. assumes the rest of the sector is a valid boot sector with a BPB. If the first
  12761. byte is not 0E9h DOS 3.2 behaves like previous versions, assumes the boot sector
  12762. is invalid and uses the first byte of the FAT to determine the media type.
  12763.  If the first byte on the disk happens to be 0E9h, but the disk does not have a
  12764. BPB, DOS 3.2 will return a disk error message.
  12765.  The real problems occur if some of the BPB data is valid and some isn't.
  12766. Apparently some OEMs have assumed that DOS would continue to ignore the
  12767. formatting data on the disk, and have failed to write much there during FORMAT
  12768. except the media descriptor byte (or, worse, have allowed random junk to be
  12769. written there). While this error is understandable, and perhaps even
  12770. forgiveable, it remains their problem, not IBM's, since the BPB area has always
  12771. been documented as containing the format information that IBM DOS 3.2 now
  12772. requires to be there.
  12773.  
  12774.  When the BPB problems first became evident with DOS 3.2 a number of reports
  12775. circulated claiming DOS looked for the letters "IBM" in the OEM ID field. This 
  12776. was incorrect. IBM DOS 4.0 *did* check for the letters "IBM" and would refuse
  12777. to recognize hard drives formatted under MSDOS 4.0. IBM corrected this with
  12778. their 4.01 revision.
  12779.  
  12780.  
  12781.  
  12782. THE DOS FILE ALLOCATION TABLE (FAT)├─────────────────────────────────── 8**3
  12783.  
  12784.  The File Allocation Table, or FAT, has three main purposes:
  12785.         1) to mark bad sectors on the media
  12786.         2) to determine which sectors are free for use
  12787.         3) to determine the physical location(s) of a file on the media.
  12788.  
  12789.  DOS uses one of two schemes for defining the File Allocation Table:
  12790.         1) a 12-bit FAT, for DOS 1.x, 2.x, all floppies, and small hard disks
  12791.         2) a 16-bit FAT, for DOS 3.x+ hard disks from 16.8 to 32Mb
  12792.  
  12793.  This section explains how DOS uses the FAT to convert the clusters of a file
  12794. into logical sector numbers. It is recommended that system utilities use the
  12795. DOS handle calls rather than interpreting the FAT, particularly since
  12796. aftermarket disk partitioning or formatting software may have been used.
  12797.  
  12798.  The FAT is used by DOS to allocate disk space for files, one cluster at a time.
  12799. In DOS 4.0, clusters are referred to as "allocation units." It means the same
  12800. things; the smallest logical portion of a drive.
  12801.  
  12802.  The FAT consists of a 12 bit entry (1.5 bytes) for each cluster on the disk or
  12803. a 16 bit (2 bytes) entry when a hard disk has more than 20740 sectors as is the
  12804. case with fixed disks larger than 10Mb.
  12805.  
  12806.  The first two FAT entries map a portion of the directory; these FAT entries
  12807. contain indicators of the size and format of the disk. The FAT can be in a 12
  12808. or 16 bit format. DOS determines whether a disk has a 12 or 16 bit FAT by
  12809. looking at the total number of allocation units on a disk. For all diskettes
  12810. and hard disks with DOS partitions less than 20,740 sectors, the FAT uses a 12
  12811. bit value to map a cluster. For larger partitions, DOS uses a 16 bit value.
  12812.  
  12813.  The second, third, and fourth bit applicable for 16 bit FAT bytes always
  12814. contains 0FFFFh. The first byte is used as follows:
  12815.  
  12816.  
  12817. Media Descriptor Byte ................................................. 8**4
  12818.  
  12819. ┌──────────────────────────────────────────────────────────────────────────────┐
  12820. │                 M E D I A    D E S C R I P T O R    B Y T E                  │
  12821. ├──────────┬──────────────────────────────────┬────────────────────────────────┤
  12822. │hex value │              meaning             │         normally used          │
  12823. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12824. │    00    │ hard disk                        │ 3.3+ extended DOS partition    │
  12825. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12826. │    ED    │ double sided  9 sector 80 track  │ Tandy 2000 720k         (5¼)   │
  12827. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12828. │    F0    │ double sided  18 sector diskette │ PS/2 1.44 meg DSHD             │
  12829. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12830. │    F8    │ hard disk                        │ bootable hard disk at C:800    │
  12831. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12832. │    F8    │ 720k floppy, 9 sector 80 track   │ Sanyo 55x, DS-DOS 2.11  (5¼)   │
  12833. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12834. │    F9    │ double sided  15 sector diskette │ AT 1.2 meg DSHD                │
  12835. │          │ double sided  9  sector diskette │ Convertible 720k DSQD          │
  12836. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12837. │    FA    │ IBM Displaywriter System disk    │ 287k                           │
  12838. │          │ Kodak "4 meg"  (Pelican)         │ 4.4 meg                 (5¼)   │
  12839. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12840. │    FB    │ IBM Displaywriter System disk    │ 1 meg                   (5¼)   │
  12841. │          │ Kodak "6 meg"  (Pelican)         │ 5.5 meg                 (5¼)   │
  12842. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12843. │    FC    │ single sided  9  sector diskette │ DOS 2.0, 180k SSDD      (5¼)   │
  12844. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12845. │    FD    │ double sided  9  sector diskette │ DOS 2.0, 360k DSDD      (5¼)   │
  12846. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12847. │    FF    │ double sided 36  sector diskette │ Practidisk 2.88mb DSED  (3½)   │
  12848. │          │ single sided  8  sector diskette │ DOS 1.0, 160k SSDD      (5¼)   │
  12849. │          │ double sided  8  sector diskette │ DOS 1.1, 320k SSDD      (5¼)   │
  12850. │          │ hard disk                        │ Sanyo 55x with DS-DOS 2.11     │
  12851. ├──────────┴───────────┬──────────────────────┴────────────────────────────────┘
  12852. │for 8 inch diskettes: │
  12853. ├──────────┬───────────┴──────────────────────┬────────────────────────────────┐
  12854. │    FD    │ double sided  26 sector diskette │ IBM 3740 format DSSD           │
  12855. ├──────────┼──────────────────────────────────┼────────────────────────────────┤
  12856. │    FE    │ single sided  26 sector diskette │ IBM 3740 format SSSD           │
  12857. │          ├──────────────────────────────────┼────────────────────────────────┤
  12858. │          │ double sided  8  sector diskette │ IBM 3740 format DSDD           │
  12859. └──────────┴──────────────────────────────────┴────────────────────────────────┘
  12860.  
  12861.  
  12862.  
  12863. The third FAT entry begins mapping the data area (cluster 002).
  12864.  
  12865. NOTE: These values are provided as a reference. Therefore, programs should not
  12866.       make use of these values.
  12867.  
  12868.  Each entry contains three hexadecimal characters for 12-bit FATs or four for
  12869. 16-bit FATs.
  12870.  
  12871. The possible entries are:
  12872.  
  12873.    12-bit   |   16-bit
  12874.             |
  12875.       000h  |        0000h   if the cluster is unused and available
  12876.  
  12877.       0FF7h |        0FFF7h  bad cluster (if not part of the allocation chain)
  12878.             |
  12879. 0FF0h-0FF7h | 0FFF0h-0FFF7h  to indicate reserved clusters
  12880.             |
  12881. 0FF8h-0FFFh | 0FFF8h-0FFFFh  to indicate the last cluster of a file (EOF)
  12882.             |
  12883.        xxxH |         xxxxH  any other hexadecimal numbers are the cluster
  12884.             |                number of the next cluster in the file. The
  12885.             |                cluster number is the first cluster in the file
  12886.             |                that is kept in the file's directory entry.
  12887.  
  12888.  The file allocation table always occupies the sector or sectors immediately
  12889. following the boot record. If the FAT is larger than 1 sector, the sectors
  12890. occupy consecutive sector numbers. Two copies of the FAT are written, one
  12891. following the other, for integrity. The FAT is read into one of the DOS buffers
  12892. whenever needed (open, allocate more space, etc).
  12893.  
  12894.  
  12895.  
  12896. 12 Bit File Allocation Table .......................................... 8**5
  12897.  
  12898. Obtain the starting cluster of the file from the directory entry.
  12899.  
  12900. Now, to locate each subsequent sector of the file:
  12901.  
  12902. 1. Multiply the cluster number just used by 1.5 (each FAT entry is 1.5
  12903.    bytes long).
  12904. 2. The whole part of the product is offset into the FAT, pointing to the entry
  12905.    that maps the cluster just used. That entry contains the cluster number of
  12906.    the next cluster in the file.
  12907. 3. Use a MOV instruction to move the word at the calculated FAT into a register.
  12908. 4. If the last cluster used was an even number, keep the low order 12 bits of
  12909.    the register, otherwise, keep the high order 12 bits.
  12910. 5. If the resultant 12 bits are (0FF8h-0FFFh) no more clusters are in the file.
  12911.    Otherwise, the next 12 bits contain the cluster number of the next cluster in
  12912.    the file.
  12913.  
  12914.   To convert the cluster to a logical sector number (relative sector, such as
  12915. that used by int 25h and 26h and DEBUG):
  12916.  
  12917. 1. Subtract 2 from the cluster number
  12918. 2. Multiply the result by the number of sectors per cluster.
  12919. 3. Add the logical sector number of the beginning of the data area.
  12920.  
  12921. 12-bit FAT if DOS partition is smaller than 32,680 sectors (16.340 MB).
  12922.  
  12923.  
  12924.  
  12925. 16 Bit File Allocation Table .......................................... 8**6
  12926.  
  12927.  Obtain the starting cluster of the file from the directory entry. Now to
  12928. locate each subsequent cluster of the file:
  12929.  
  12930. 1.  Multiply the cluster number used by 2 (each FAT entry is 2 bytes long).
  12931. 2.  Use the MOV word instruction to move the word at the calculated FAT offset
  12932.     into a register.
  12933. 3.  If the resultant 16 bits are (0FF8h-0FFFFh) no more clusters are in the
  12934.     file. Otherwise, the 16 bits contain the cluster number of the next cluster
  12935.     in the file.
  12936.  
  12937.  
  12938.  
  12939.  
  12940. DOS Disk Directory .................................................... 8**8
  12941.  
  12942.  The FORMAT command initially builds the root directory for all disks. Its
  12943. location (logical sector number) and the maximum number of entries are
  12944. available through the device driver interfaces.
  12945.  
  12946.  Since directories other than the root directory are actually files, there is
  12947. no limit to the number of entries that they may contain.
  12948.  
  12949.  All directory entries are 32 bytes long, and are in the following format:
  12950. ┌───────┬─────────┬────────────────────────────────────────────────────────────
  12951. │offset │  size   │                  DISK DIRECTORY ENTRY
  12952. ├───────┼─────────┼────────────────────────────────────────────────────────────
  12953. │  00h  │ 8 bytes │ Filename
  12954. │       ├─────────┴────────────────────────────────────────────────────────────
  12955. │       │ The first byte of the filename indicates the file status.
  12956. │       │ The file status byte may contain the following values:
  12957. │       ├──────┬───────────────────────────────────────────────────────────────
  12958. │       │  00h │ Directory entry has never been used. This is used to limit
  12959. │       │      │ the length of directory searches, for performance reasons.
  12960. │       │  05h │ Indicates that the first character of the filename actually
  12961. │       │      │ has an 0EDh character.
  12962. │       │ 0E5h │ Filename has been used but the file has been erased.
  12963. │       │  2Eh │ This entry is for a directory. If the second byte is also
  12964. │       │      │ 2Eh, the cluster field contains the cluster number of this
  12965. │       │      │ directory's parent directory. (0000h if the parent directory
  12966. │       │      │ is the root directory). Otherwise, bytes 00h-0Ah are all
  12967. │       │      │ spaces and the cluster field contains the cluster number of
  12968. │       │      │ the directory.
  12969. │       ├──────┴───────────────────────────────────────────────────────────────
  12970. │       │ Any other character is the first character of a filename. Filenames
  12971. │       │ are left-aligned and if necessary padded with blanks.
  12972. ├───────┼─────────┬────────────────────────────────────────────────────────────
  12973. │  08h  │ 3 bytes │ Filename extension if any
  12974. │       ├─────────┴────────────────────────────────────────────────────────────
  12975. │       │ Three characters, left-aligned and padded with blanks if necessary.
  12976. │       │ If there is no file extension, this field contains all blanks
  12977. ├───────┼─────────┬────────────────────────────────────────────────────────────
  12978. │  0Bh  │ 1 byte  │ File attributes
  12979. │       ├─────────┴────────────────────────────────────────────────────────────
  12980. │       │          The attribute byte is mapped as follows:
  12981. │       ├─────┬───┬────────────────────────────────────────────────────────────
  12982. │       │ hex │bit│                    meaning
  12983. │       ├─────┼───┼────────────────────────────────────────────────────────────
  12984. │       │ 00h │   │ (no bits set) normal; can be read or written without
  12985. │       │     │   │ restriction
  12986. │       │ 01h │ 0 │ file is marked read-only. An attempt to open the file for
  12987. │       │     │   │ output using int 21h/fn 3Dh will fail and an error code
  12988. │       │     │   │ will be returned. This value can be used with other values
  12989. │       │     │   │ below.
  12990. │       │ 02h │ 1 │ indicates a hidden file. The file is excluded from normal
  12991. │       │     │   │ directory searches.
  12992. │       │ 04h │ 2 │ indicates a system file. The file is excluded from normal
  12993. │       │     │   │ directory searches.
  12994. │       │ 08h │ 3 │ indicates that the entry contains the volume label in the
  12995. │       │     │   │ first 11 bytes. The entry has no other usable information
  12996. │       │     │   │ and may exist only in the root directory.
  12997. │       │ 10h │ 4 │ indicates that the file is a subdirectory
  12998. │       │ 20h │ 5 │ indicates an archive bit. This bit is set to on whenever
  12999. │       │     │   │ the file is written to and closed. Used by BACKUP and
  13000. │       │     │   │ RESTORE.
  13001. │       │     │ 6 │ reserved, set to 0
  13002. │       │     │ 7 │ reserved, set to 0
  13003. │       ├─────┴───┴────────────────────────────────────────────────────────────
  13004. │       │ note 1) Bits 6 and 7 may be used in OS/2.
  13005. │       │ note 2) Attributes 08h and 10h cannot be changed using int21/43h.
  13006. │       │ note 3) The system files IBMBIO.COM and IBMDOS.COM (or customized
  13007. │       │         equivalent) are marked as read-only, hidden, and system
  13008. │       │         files. Files can be marked hidden when they are created.
  13009. │       │ note 4) Read-only, hidden, system and archive attributes may be
  13010. │       │         changed with int21h/fn43h.
  13011. ├───────┼─────────┬────────────────────────────────────────────────────────────
  13012. │  0Ch  │ 10 bytes│ Reserved by DOS; value unknown
  13013. ├───────┼─────────┼────────────────────────────────────────────────────────────
  13014. │  16h  │ 2 bytes │ File timestamp
  13015. │       ├─────────┴────────────────────────────────────────────────────────────
  13016. │       │ These bytes contain the time when the file was created or last
  13017. │       │  updated. The time is mapped in the bits as follows:
  13018. │       ├───────────────────────────────┬───────────────────────────────┐
  13019. │       │         B Y T E   16h         │         B Y T E   17h         │
  13020. │       ├───────────────────────────────┼───────────────────────────────┤
  13021. │       │ F   E   D   C   B   A   9   8 │ 7   6   5   4   3   2   1   0 │
  13022. │       ├───────────────────┬───────────┴───────────┬───────────────────┤
  13023. │       │ H   H   H   H   H │ M   M   M   M   M   M │ D   D   D   D   D │
  13024. │       ├───────────────────┼───────────────────────┼───────────────────┤
  13025. │       │ binary # hrs 0-23 │ binary # minutes 0-59 │ bin. # 2-sec incr │
  13026. │       ├───────────────────┴───────────────────────┴───────────────────┘
  13027. │       │ note: The time is stored with the least significant byte first.
  13028. ├───────┼─────────┬────────────────────────────────────────────────────────────
  13029. │  18h  │ 2 bytes │ File datestamp
  13030. │       ├─────────┴────────────────────────────────────────────────────────────
  13031. │       │ This area contains the date when the file was created or last
  13032. │       │ updated. The mm/dd/yy are mapped in the bits as follows:
  13033. │       ├───────────────────────────────┬───────────────────────────────┐
  13034. │       │         B Y T E   18h         │         B Y T E   19h         │
  13035. │       ├───────────────────────────────┼───────────────────────────────┤
  13036. │       │ F   E   D   C   B   A   9   8 │ 7   6   5   4   3   2   1   0 │
  13037. │       ├───────────────────────────┬───┴───────────┬───────────────────┤
  13038. │       │ Y   Y   Y   Y   Y   Y   Y │ M   M   M   M │ D   D   D   D   D │
  13039. │       ├───────────────────────────┼───────────────┼───────────────────┤
  13040. │       │     0-119 (1980-2099)     │     1-12      │       1-31        │
  13041. │       ├───────────────────────────┴───────────────┴───────────────────┘
  13042. │       │ note: The date is stored with the least significant byte first.
  13043. ├───────┼─────────┬────────────────────────────────────────────────────────────
  13044. │  1Ah  │ 2 bytes │ First file cluster number
  13045. │       ├─────────┴────────────────────────────────────────────────────────────
  13046. │       │ * (reserved in DOS 2, documented in DOS 3+)
  13047. │       │ This area contains the starting cluster number of the first cluster
  13048. │       │ in the file. The first cluster for data space on all fixed disks and
  13049. │       │ floppy disks is always cluster 002. The cluster number is stored
  13050. │       │ with the least significant byte first.
  13051. ├───────┼─────────┬────────────────────────────────────────────────────────────
  13052. │  1Ch  │ 4 bytes │ File size
  13053. │       ├─────────┴────────────────────────────────────────────────────────────
  13054. │       │ This area contains the file size in bytes. The first word contains
  13055. │       │ the low order part of the size. Both words are stored with the least
  13056. │       │ significant byte first.
  13057. └───────┴──────────────────────────────────────────────────────────────────────
  13058.  
  13059.  
  13060.  
  13061. The Data Area ......................................................... 8**9
  13062.  
  13063.  Allocation of space for a file (in the data area) is done only when needed
  13064. (it is not preallocated). The space is allocated one cluser (unit allocation)
  13065. at a time. A cluster is always one or more consecutive sector numbers, and all
  13066. of the clusters in a file are "chained" together in the FAT.
  13067.  
  13068.  The clusters are arranged on disk to minimize head movement for multisided
  13069. media. All of the space on a track (or cylinder) is allocated before moving
  13070. on to the next track. This is accomplished by using the sequential sector
  13071. numbers on the lowest-numbered head, then all the sector numbers on the next
  13072. head, and so on until all sectors of all heads of the track are used. Then the
  13073. next sector used will be sector 1 of head 0 on the next track.
  13074.  
  13075.  An interesting innovation that was introduced in MS-DOS 3.0: disk space that
  13076. is freed by erasing a file is not re-used immediately, unlike earlier versions
  13077. of DOS. Instead, free space is obtained from the area not yet used during the
  13078. current session, until all of it is used up. Only then will space that is freed
  13079. during the current session be re-used.
  13080.  
  13081.  This feature minimizes fragmentation of files, since never-before-used space
  13082. is always contiguous. However, once any space has been freed by deleting a file,
  13083. that advantage vanishes at the next system boot. The feature also greatly
  13084. simplifies un-erasing files, provided that the need to do an un-erase is found
  13085. during the same session and also provided that the file occupies contiguous
  13086. clusters.
  13087.  
  13088.  However, when one is using programs which make extensive use of temporary
  13089. files, each of which may be created and erased many times during a session,
  13090. the feature becomes a nuisance; it forces the permanent files to move farther
  13091. and farther into the inner tracks of the disk, thus increasing rather than
  13092. decreasing the amount of fragmentation which occurs.
  13093.  
  13094.  The feature is implemented in DOS by means of a single 16-bit "last cluster
  13095. used" (LCU) pointer for each physical disk drive; this pointer is a part of
  13096. the physical drive table maintained by DOS. At boot time, the LCU pointer is
  13097. zeroed. Each time another cluster is obtained from the free-space pool (the
  13098. FAT), its number is written into the LCU pointer. Each time a fresh cluster
  13099. is required, the FAT is searched to locate a free one; in older versions of
  13100. DOS this search always began at Cluster 0000, but in 3.x it begins at the
  13101. cluster pointed to by the LCU pointer.
  13102.  
  13103.  For hard disks, the size of the file allocation table and directory are
  13104. determined when FORMAT initializes it and are based on the size of the DOS
  13105. partition.
  13106.  
  13107.  
  13108.  
  13109. Floppy Disk Types ..................................................... 8**10
  13110.  
  13111. The following tables give the specifications for floppy disk formats:
  13112.  
  13113. IBM PC-DOS disk formats:
  13114.                  # of      FAT size   DIR     total
  13115.                  sides    (sectors)(entries) sectors
  13116.                    │  sectors  │  DIR  │ sectors│
  13117.                    │  /track   │sectors│/cluster│
  13118.                    │     │     │   │   │   │    │
  13119. ┌─────┬──┬───────┬─┴─┬───┴───┬─┴─┬─┴─┬─┴─┬─┴─┬──┴─┬────────────────────────────
  13120. │ 160k│5¼│DOS 1.0│ 1 │ 8 (40)│ 1 │ 4 │ 64│ 1 │ 320│Original PC-0, 16k mbd
  13121. │ 320k│5¼│DOS 1.1│ 2 │ 8 (40)│ 1 │ 7 │112│ 2 │ 360│PC-1, 64k mbd
  13122. │ 180k│5¼│DOS 2.0│ 1 │ 9 (40)│ 2 │ 4 │ 64│ 1 │ 640│PC-2, 256k mbd
  13123. │ 360k│5¼│DOS 2.0│ 2 │ 9 (40)│ 2 │ 7 │112│ 2 │ 720│PC/XT
  13124. │ 1.2M│5¼│DOS 3.0│ 2 │15 (80)│ 7 │14 │224│ 1 │2400│PC/AT, PC/RT, XT/286
  13125. │ 720k│3½│DOS 3.2│ 2 │ 9 (80)│ 3 │ 7 │112│ 2 │1440│Convertible, PS/2 25+
  13126. │1.44M│3½│DOS 3.3│ 2 │18 (80)│ 9 │14 │224│ 1 │2880│PS/2 50+
  13127. └─────┴──┴───────┴───┴───────┴───┴───┴───┴───┴────┴────────────────────────────
  13128. various MS-DOS disk formats:
  13129. ┌─────┬──┬───────┬─┴─┬───┴───┬─┴─┬─┴─┬─┴─┬─┴─┬──┴─┬────────────────────────────
  13130. │ 200k│5¼│  *    │ 1 │10 (40)│   │   │   │   │    │
  13131. │ 400k│5¼│  * ** │ 2 │10 (40)│   │   │   │   │    │
  13132. │ 800k│5¼│  *    │ 2 │10 (80)│   │   │   │   │    │
  13133. │ 720k│2 │       │   │       │   │   │   │   │    │Zenith SuperSport 2-inch
  13134. │ 720k│5¼│DOS2.11│ 2 │ 9 (80)│ 3 │ 7 │112│ 2 │1440│Tandy 2000 (discontinued)
  13135. │2.88M│3½│       │ 2 │36 (80)│   │   │   │   │5760│Practidisk 2.88mb floppy
  13136. │2720k│5¼│  ***  │ 2 │17(192)│ 8 │   │272│ 4 │5440│Pelican (Kodak 3.3Mb)(disc.)
  13137. │5570k│5¼│  ***  │ 2 │17(384)│ 8 │   │272│ 4 │10880Pelican (Kodak 6.6Mb)(disc.)
  13138. └─────┴──┴───────┴───┴───────┴───┴───┴───┴───┴────┴────────────────────────────
  13139. *   Michtron DS-DOS 2.11 Plus and one version of MS-DOS 3.11 (vendor unknown)
  13140. **  TallTree JFormat program
  13141. *** Pelican driver source calls for 2 sectors/cluster, Norton Utils reports 4.
  13142. ┌─────┬──┬───────┬─┴─┬───┴───┬─┴─┬─┴─┬─┴─┬─┴─┬──┴─┬────────────────────────────
  13143. │ 400k│5¼│DOS2.11│ 1 │10 (80)│   │   │   │   │ 800│DEC Rainbow  SS/HD   (disc.)
  13144. │ 720k│5¼│DOS2.11│ 2 │variable number of sectors  │Victor 9000 PC   (discont'd)
  13145. └─────┴──┴───────┴───┤per track, more sectors on  ├────────────────────────────
  13146.                      │outer tracks than inner     │
  13147.                      │tracks. Special DSDD drive. │
  13148.                      └────────────────────────────┘
  13149.  
  13150.  Some oddball DOS versions specify "zero" heads in their data area. HP's
  13151. single-sided disk format (16 256-byte sectors/track, model unknown) uses a
  13152. zero-based parameter for the number of heads. Without special device driver
  13153. software to "fix" this, these disks are basically unusable by normal DOS.
  13154.  
  13155.  A couple of people have reported that the IBM "Gearbox" industrial PC uses
  13156. an 800k 3.5 inch floppy with 10 sectors and 80 tracks. I've been unable to
  13157. confirm this.
  13158.  
  13159.  Files in the data area are not necessarily written sequentially. The data area
  13160. space is allocated one cluster at a time, skipping over clusters already
  13161. allocated. The first free cluster found is the next cluster allocated,
  13162. regardless of its physical location on the disk. This permits the most efficient
  13163. utilization of disk space because clusters freed by erasing files can be
  13164. allocated for new files. Refer back to the description of the DOS FAT in this
  13165. chapter for more information.
  13166.  
  13167.         SSDD    single sided, double density     (160-180k)     5¼
  13168.         DSDD    double sided, double density     (320-360k)     5¼
  13169.         DSQD    double sided, quad density       (720k)         5¼, 3½, 2
  13170.         DSHD    double sided, high density       (1.2-1.44M)    5¼, 3½
  13171.         DSED    double sided, extra high density (2.88M)        3½
  13172.  
  13173.  Much of the trouble with AT 1.2 meg drives has been through the inadverdent
  13174. use of quad density disks in the high density drives. The high density disks
  13175. use a higher-coercivity media than the quads, and quads are not completely
  13176. reliable as 1.2Mb. Make sure you have the correct disk for your application.
  13177.  
  13178.  
  13179. ROTATION SPEEDS:
  13180.  
  13181.         720k,   3½"    (unknown)  note: Zenith has discontinued 2" floppies
  13182.  
  13183.         720k,   3½"    300 RPM
  13184.         1.44Mb, 3½"    300 RPM
  13185.  
  13186.         360k,   5¼"    300 RPM
  13187.         720k,   5¼"    300 RPM
  13188.         1.2mb,  5¼"    360 RPM   (even when reading 360k diskettes)
  13189.  
  13190.         all      8"    360 RPM
  13191.  
  13192.  The Victor 9000's 5¼" floppies could vary their rotational speed as required. 
  13193. This allowed them to put 720k on a standard 360k floppy, using a constant 
  13194. density throughout.
  13195.  
  13196.  The Central Point CopyIIPC Option Board emulates the Macintosh GCR recording 
  13197. format by varying the data rate instead of the rotational speed.
  13198.  
  13199.  
  13200.  
  13201.  
  13202. HARD DISK LAYOUT ...................................................... 8**11
  13203.  
  13204.  The DOS hard disk routines perform the following services:
  13205.  
  13206. 1) Allow multiple operating systems to be installed on the hard disk at the
  13207.    same time.
  13208.  
  13209. 2) Allow a user-selected operating system to be started from the hard disk.
  13210.  
  13211.    I) In order to share the hard disk among operating systems, the disk may be
  13212.       logically divided into 1 to 4 partitions. The space within a given
  13213.       partition is contiguous, and can be dedicated to a specific operating
  13214.       system. Each operating system may "own" only one partition in DOS versions
  13215.       2.0 through 3.2. DOS 3.3 introduced the "Extended DOS Partition" which
  13216.       allows multiple DOS partitions on the same hard disk. FDISK (or a
  13217.       similar program from other DOS vendors) utility allows the user to select
  13218.       the number, type, and size of each partition. The partition information is
  13219.       kept in a partition table that is embedded in the master hard disk boot
  13220.       record on the first sector of the disk. The format of this table varies
  13221.       from version to version of DOS.
  13222.  
  13223.   II) An operating system must consider its partition to be the entire disk,
  13224.       and must ensure that its functions and utilities do not access other
  13225.       partitions on the disk.
  13226.  
  13227.  III) Each partition may contain a boot record on its first sector, and any
  13228.       other programs or data that you choose, including a different operating
  13229.       system. For example, the DOS FORMAT command may be used to format and
  13230.       place a copy of DOS in the DOS partition in the same manner that a
  13231.       diskette is formatted. You can use FDISK to designate a partition as
  13232.       "active" (bootable). The master hard disk boot record causes that
  13233.       partition's boot record to receive control when the system is
  13234.       initialized. Additional disk partitions could be FORTH, UNIX, Pick,
  13235.       CP/M-86, OS/2 HPFS, Concurrent DOS, Xenix, or the UCSD p-System.
  13236.  
  13237.  
  13238.  
  13239. SYSTEM INITIALIZATION ................................................. 8**12
  13240.  
  13241. The boot sequence is as follows:
  13242.  
  13243. 1. System initialization first attempts to load an operating system from
  13244.    diskette drive A. If the drive is not ready or a read error occurs, it then
  13245.    attempts to read a master hard disk boot record on the first sector of the
  13246.    first hard disk in the system. If unsuccessful, or if no hard disk is
  13247.    present, it invokes ROM BASIC in an IBM PC or displays a disk error
  13248.    message on most compatibles.
  13249.  
  13250. 2. If initialization is successful, the master hard disk boot record is given
  13251.    control and it examines the partition table embedded within it. If one of
  13252.    the entries indicates an active (bootable) partition, its boot record is
  13253.    read from the partition's first sector and given control.
  13254.  
  13255. 3. If none of the partitions is bootable, ROM BASIC is invoked on an IBM PC or
  13256.     a disk error on most compatibles.
  13257.  
  13258. 4. If any of the boot indicators are invalid, or if more than one indicator is
  13259.    marked as bootable, the message "INVALID PARTITION TABLE "is displayed and
  13260.    the system stops.
  13261.  
  13262. 5. If the partition's boot record cannot be successfully read within five
  13263.    retries due to read errors, the message "ERROR LOADING OPERATING SYSTEM"
  13264.    appears and the system stops.
  13265.  
  13266. 6. If the partition's boot record does not contain a valid "signature", the
  13267.    message "MISSING OPERATING SYSTEM" appears, and the system stops.
  13268.  
  13269. NOTE: When changing the size or location of any partition, you must ensure that
  13270.       all existing data on the disk has been backed up. The partitioning program
  13271.       will destroy the data on the disk.
  13272.  
  13273.  System programmers designing a utility to initialize/manage a hard disk must
  13274. provide the following functions at a minimum:
  13275.  
  13276. 1. Write the master disk boot record/partition table to the disk's first
  13277.    sector to initialize it.
  13278.  
  13279. 2. Perform partitioning of the disk - that is, create or update the partition
  13280.    table information (all fields for the partition) when the user wishes
  13281.    to create a partition. This may be limited to creating a partition for only
  13282.    one type of operating system, but must allow repartitoning the entire disk,
  13283.    or adding a partition without interfering with existing partitions (user's
  13284.    choice).
  13285.  
  13286. 3. Provide a means for marking a user-specified partition as bootable and
  13287.    resetting the bootable indicator bytes for all other partitions at the same
  13288.    time.
  13289.  
  13290. 4. Such utilities should not change or move any partition information that
  13291.    belongs to another operating system.
  13292.  
  13293.  
  13294.  
  13295.  
  13296. BOOT RECORD/PARTITION TABLE ........................................... 8**13
  13297.  
  13298.  A boot record must be written on the first sector of all hard disks, and
  13299. must contain the following:
  13300.  
  13301. 1. Code to load and give control to the boot record for one of four possible
  13302.    operating systems.
  13303.  
  13304. 2. A partition table at the end of the boot record. Each table entry is 16
  13305.    bytes long, and contains the starting and ending cylinder, sector, and head
  13306.    for each of four possible partitions, as well as the number of sectors
  13307.    preceding the partition and the number of sectors occupied by the partition.
  13308.    The "boot indicator" byte is used by the boot record to determine if one of
  13309.    the partitions contains a loadable operating system. FDISK initialization
  13310.    utilities mark a user-selected partition as "bootable" by placing a value
  13311.    of 80h in the corresponding partition's boot indicator (setting all other
  13312.    partitions' indicators to 0 at the same time). The presence of the 80h tells
  13313.    the standard boot routine to load the sector whose location is contained in
  13314.    the following three bytes. That sector is the actual boot record for the
  13315.    selected operating system, and it is responsible for the remainder of the
  13316.    system's loading process (as it is from the diskette). All boot records are
  13317.    loaded at absolute address 0:7C00.
  13318.  
  13319. The partition table with its offsets into the boot record is:
  13320. ┌──────────┬──────────┬──────────┬────────┬────────────────────────────────────
  13321. │  Offset  │  Offset  │  Offset  │        │
  13322. │from Start│from Start│from Start│  Size  │ Description
  13323. │ of Disk  │ of Entry │ of Disk  │        │                                   
  13324. ├──────────┼──────────┼──────────┼────────┼────────────────────────────────────
  13325. │          │    00h   │   0BEh   │ 1 byte │ boot indicator
  13326. │          │    01h   │   0BFh   │ 1 byte │ beginning head
  13327. │   1BEh   │    02h   │   0C0h   │ 1 byte │ beginning sector
  13328. │ (part 1) │    03h   │   0C1h   │ 1 byte │ beginning cylinder
  13329. │ 16 bytes │    04h   │   0C2h   │ 1 byte │ system indicator
  13330. │          │    05h   │   0C3h   │ 1 byte │ ending head
  13331. │          │    06h   │   0C4h   │ 1 byte │ ending sector
  13332. │          │    07h   │   0C5h   │ 1 byte │ ending cylinder
  13333. │          │    08h   │   0C6h   │ 4 bytes│ relative (starting) sector       
  13334. │          │    0Ch   │   0DAh   │ 4 bytes│ number of sectors       
  13335. ├──────────┼──────────┼──────────┼────────┼────────────────────────────────────
  13336. │          │    00h   │   0DEh   │ 1 byte │ boot indicator
  13337. │          │    01h   │   0DFh   │ 1 byte │ beginning head
  13338. │   1CEh   │    02h   │   0E0h   │ 1 byte │ beginning sector
  13339. │ (part 2) │    03h   │   0E1h   │ 1 byte │ beginning cylinder
  13340. │ 16 bytes │    04h   │   0E2h   │ 1 byte │ system indicator
  13341. │          │    05h   │   0E3h   │ 1 byte │ ending head
  13342. │          │    06h   │   0E4h   │ 1 byte │ ending sector
  13343. │          │    07h   │   0E5h   │ 1 byte │ ending cylinder
  13344. │          │    08h   │   0E6h   │ 4 bytes│ relative (starting) sector       
  13345. │          │    0Ch   │   0EAh   │ 4 bytes│ number of sectors       
  13346. ├──────────┼──────────┼──────────┼────────┼────────────────────────────────────
  13347. │          │    00h   │   0FEh   │ 1 byte │ boot indicator
  13348. │          │    01h   │   0FFh   │ 1 byte │ beginning head
  13349. │   1DEh   │    02h   │   0100h  │ 1 byte │ beginning sector
  13350. │ (part 3) │    03h   │   0101h  │ 1 byte │ beginning cylinder
  13351. │ 16 bytes │    04h   │   0102h  │ 1 byte │ system indicator
  13352. │          │    05h   │   0103h  │ 1 byte │ ending head
  13353. │          │    06h   │   0104h  │ 1 byte │ ending sector
  13354. │          │    07h   │   0105h  │ 1 byte │ ending cylinder
  13355. │          │    08h   │   0106h  │ 4 bytes│ relative (starting) sector       
  13356. │          │    0Ch   │   010Ah  │ 4 bytes│ number of sectors       
  13357. ├──────────┼──────────┼──────────┼────────┼────────────────────────────────────
  13358. │          │    00h   │   010Eh  │ 1 byte │ boot indicator
  13359. │          │    01h   │   011Fh  │ 1 byte │ beginning head
  13360. │   1EEh   │    02h   │   0110h  │ 1 byte │ beginning sector
  13361. │ (part 4) │    03h   │   0111h  │ 1 byte │ beginning cylinder
  13362. │ 16 bytes │    04h   │   0112h  │ 1 byte │ system indicator
  13363. │          │    05h   │   0113h  │ 1 byte │ ending head
  13364. │          │    06h   │   0114h  │ 1 byte │ ending sector
  13365. │          │    07h   │   0115h  │ 1 byte │ ending cylinder
  13366. │          │    08h   │   0116h  │ 4 bytes│ relative (starting) sector       
  13367. │          │    0Ch   │   011Ah  │ 4 bytes│ number of sectors       
  13368. ├──────────┼──────────┴──────────┼────────┼────────────────────────────────────
  13369. │   1FEh   │                     │ 2 bytes│ 055AAh signature
  13370. └──────────┴─────────────────────┴────────┴────────────────────────────────────
  13371.  
  13372.  Boot indicator (boot ind): The boot indicator byte must contain 0 for a non-
  13373. bootable partition or 80h for a bootable partition. Only one partition can be
  13374. marked as bootable at a time.
  13375.  
  13376.  System Indicator (sys ind): The sys ind field contains an indicator of the
  13377. operating system that "owns" the partition. IBM PC-DOS can only "own" one
  13378. partition, though some versions of MSDOS allow all four partitions to be used
  13379. by DOS.
  13380.  
  13381.  The system indicators are:
  13382.  
  13383.         ┌─────────────────────────────────────────────────────────────┐
  13384.         │                 System Indicator  (sys ind)                 │
  13385.         ├───────┬─────────────────────────────────────────────────────┤
  13386.         │  00h  │  unknown or no partition defined                    │
  13387.         ├───────┼─────────────────────────────────────────────────────┤
  13388.         │  01h  │  DOS 12 bit FAT  (DOS 2.x all and 3.x+ under 16 Mb) │
  13389.         │       │                  less than 4086 clusters            │
  13390.         ├───────┼─────────────────────────────────────────────────────┤
  13391.         │  02h  │  Xenix                                              │
  13392.         ├───────┼─────────────────────────────────────────────────────┤
  13393.         │  03h  │  Xenix                                              │
  13394.         ├───────┼─────────────────────────────────────────────────────┤
  13395.         │  04h  │  DOS 16 bit FAT  (DOS 3.0+. Not recognized by 2.x)  │
  13396.         │       │                  less than 65,536 sectors           │
  13397.         ├───────┼─────────────────────────────────────────────────────┤
  13398.         │  05h  │  extended DOS partition, some 3.2 and all 3.3+      │
  13399.         │       │  (pointer to further partition table)               │
  13400.         ├───────┼─────────────────────────────────────────────────────┤
  13401.         │  06h  │  Compaq DOS 3.31, DOS 4.0+ partitions over 32 megs  │
  13402.         │       │  Digital Research DRDOS 3.4, 3.41 over 32 megs      │
  13403.         ├───────┼─────────────────────────────────────────────────────┤
  13404.         │  06h  │  PC-MOS/386 partitions over 32 megs (NOT compatible │
  13405.         │       │  with the DR, Compaq, and MSDOS big partitions!     │
  13406.         ├───────┼─────────────────────────────────────────────────────┤
  13407.         │  07h  │  OS/2 High Performance File System                  │
  13408.         ├───────┼─────────────────────────────────────────────────────┤
  13409.         │  051h │  Ontrack Disk Manager "read/write" partitions       │
  13410.         ├───────┼─────────────────────────────────────────────────────┤
  13411.         │  0DBh │  DRI Concurrent DOS              (>32mb partitions?)│
  13412.         │       │  DRI Concurrent CP/M?                               │
  13413.         ├───────┼─────────────────────────────────────────────────────┤
  13414.         │  0E4h │  Speedstor, small partitions (?) (under 1024cyl?)   │
  13415.         ├───────┼─────────────────────────────────────────────────────┤
  13416.         │  0F2h │  2nd DOS partition, some OEM customized DOS 3.2     │
  13417.         ├───────┼─────────────────────────────────────────────────────┤
  13418.         │  0F4h │  Speedstor, large partitions (?)                    │
  13419.         ├───────┼─────────────────────────────────────────────────────┤
  13420.         │  0FEh │  Speedstor, partitions >1024 cylinders              │
  13421.         └───────┴─────────────────────────────────────────────────────┘
  13422.  
  13423.  There are ID bytes for proprietary formatting schemes. Some manufacturers
  13424. (such as Zenith, Wyse, and Tandon) diddle with these system bytes to implement
  13425. more than one DOS partition per disk.
  13426.  
  13427. note 1) Xenix doesn't like extended DOS partitions a'la DOS 3.3, limiting you
  13428.         to a DOS partition of 32Mb. Xenix doesn't recognize DOS 4.0x at all,
  13429.         so to use it you need to boot from a floppy. Early versions of OS/2
  13430.         also have this problem.
  13431.     2)  I have found one source listing Minix partitions as "40" and some
  13432.         Unix partitions as "63".  I don't know if these are decimal or
  13433.         hexadecimal figures.
  13434.  
  13435.  Cylinder (CYL) and Sector (S): The 1 byte fields labelled CYL contain the low
  13436. order 8 bits of the cylinder number - the high order 2 bits are in the high
  13437. order 2 bits of the sector (S) field. This corresponds with the ROM BIOS
  13438. interrupt 13h (disk I/O) requirements, to allow for a 10 bit cylinder number.
  13439.  
  13440.  The fields are ordered in such a manner that only two MOV instructions are
  13441. required to properly set up the DX and CX registers for a ROM BIOS call to
  13442. load the appropriate boot record (hard disk booting is only possible from the
  13443. first hard disk in the system, where a BIOS drive number of 80h corresponds
  13444. to the boot indicator byte).
  13445.  
  13446.  All partitions are allocated in cylinder multiples and begin on sector 1,
  13447. head 0, with the exception that the partition that is allocated at the beginning
  13448. of the disk starts at sector 2, to account for the hard disk's master boot
  13449. record.
  13450.  
  13451.  Relative (starting) Sector: The number of sectors preceding each partition
  13452. on the disk is kept in this 4 byte field. This value is determined by counting
  13453. the sectors beginning with cylinder 0, sector 1, head 0 of the disk, and
  13454. incrementing the sector, head, and then track values up to the beginning of
  13455. the partition. This, if the disk has 17 sectors per track and 4 heads, and the
  13456. second partition begins at cylinder 1, sector 1, head 0, then the partition's
  13457. starting relative sector is 68 (decimal) - there were 17 sectors on each of 4
  13458. heads on 1 track allocated ahead of it. The field is stored with the least
  13459. significant word first.
  13460.  
  13461.  Number of sectors (#sects): The number of sectors allocated to the partition
  13462. is kept in the "# of sects" field. This is a 4 byte field stored least
  13463. significant word first.
  13464.  
  13465.  Signature: The last 2 bytes of the boot record (55AAh) are used as a signature
  13466. to identify a valid boot record. Both this record and the partition boot record
  13467. are required to contain the signature at offset 1FEh.
  13468.  
  13469.  
  13470.  
  13471. HARD DISK TECHNICAL INFORMATION ....................................... 8**14
  13472.  
  13473.  Western Digital's hard disk installation manuals make the claim that MSDOS
  13474. can support only 2 hard drives. This is entirely false, and their purpose for
  13475. making the claim is unclear. DOS merely performs a function call pointed at
  13476. the hard disk driver, which is normally in one of three locations; a ROM at
  13477. absolute address C:800, the main BIOS ROM if the machine is an AT, or a device
  13478. driver installed through the CONFIG.SYS file. Two hard disk controller cards
  13479. can normally not reside in the same machine due to lack of interrupt
  13480. arbitration. Perstor's ARLL controller and some cards marketed by Novell can
  13481. coexist with other controllers. Perstor's technical department has had four
  13482. controllers and eight hard disks in the same IBM XT functioning concurrently.
  13483.  
  13484.  A valid hard disk has a boot record arranged in the following manner:
  13485.  
  13486.         db      drive           ; 0 or 80h  (80h marks a bootable, active
  13487.                                              partition)
  13488.         db      head1           ; starting head
  13489.         dw      trksec1         ; starting track/sector (CX value for INT 13)
  13490.         db      system          ; SYS IND ID from table above
  13491.         db      head2           ; ending head
  13492.         dw      trksec2         ; ending track/sector
  13493.         dd      sector1         ; absolute # of starting sector
  13494.         dd      sector2         ; absolute # of last sector
  13495.  
  13496.  The master disk boot record invokes ROM BASIC if no indicator byte reflects a
  13497. bootable system.
  13498.  
  13499.  When a partition's boot record is given control, it is passed its partition
  13500. table entry address in the DS:SI registers.
  13501.  
  13502.  
  13503.  
  13504. DETERMINING HARD DISK ALLOCATION ...................................... 8**15
  13505.  
  13506. DOS determines disk allocation using the following formula:
  13507.  
  13508.                                          D * BPD
  13509.                             TS - RS -  ───────────
  13510.                                            BPS
  13511.                       SPF = ──────────────────────────────
  13512.                                         BPS * SPC
  13513.                                  CF + ──────────────
  13514.                                            BPC
  13515. where:
  13516.  
  13517.      TS      Total number of sectors on the disk
  13518.      RS      The number of sectors at the beginning of the disk that are
  13519.              reserved for the boot record. DOS normally reserves 1 sector.
  13520.      D       The number of directory entries in the root directory.
  13521.      BPD     The number of bytes per directory entry. This is always 32.
  13522.      BPS     The number of bytes per logical sector. Typically 512, but you can
  13523.              specify a different number with VDISK.
  13524.      CF      The number of FATS per disk. Usually 2. VDISK is 1.
  13525.      SPF     The number of sectors per FAT. Maximum 64.
  13526.      SPC     The number of sectors per allocation unit (cluster).
  13527.      BPC     The number of bytes per FAT entry. BPC is 1.5 for 12 bit FATs.
  13528.              2 for 16 bit FATS.
  13529.  
  13530.  
  13531. To calculate the minimum partition size that will force a 16-bit FAT:
  13532.  
  13533.         CYL = (max clusters * 8)/(HEADS * SPT)
  13534.  
  13535. where:
  13536.      CYL           number of cylinders on the disk
  13537.      max clusters  4092 (maximum number of clusters for a 12 bit FAT)
  13538.      HEADS         number of heads on the hard disk
  13539.      SPT           sectors per track  (normally 17 on MFM)
  13540.  
  13541.  
  13542.  DOS 2.0 through 3.3 limit partition sizes to 32 megabytes. The limit arises
  13543. from the fact that DOS does things by sector number, and each sector is stored
  13544. as a word. So the largest sector number DOS can count to is 64k. As each
  13545. sector is 512 bytes long, 64k * .5k = 32Mb. The easiest way for an aftermarket
  13546. disk handler to break the 32Mb barrier is probably to increase the sector size
  13547. - with 2k sectors, maximum partiton size increases to 128Mb. However, the BIOS
  13548. boot routines and IBMBIO.COM are hardwired for 512 byte sectors, so you won't
  13549. be able to boot from a drive with oversize sectors. That's why Disk Manager
  13550. formats a small boot partition by default.
  13551.  
  13552.  DOS 2.x uses a "first fit" algorithm when allocating file space on the hard
  13553. disk. Each time an application requests disk space, it will scan from the
  13554. beginning of the FAT until it finds a contiguous peice of storage large enough
  13555. for the file.
  13556.  
  13557.  DOS 3.x+ keeps a pointer into the disk space, and begins its search from the
  13558. point it last left off. This pointer is lost when the system is rebooted.
  13559. This is called the "next fit" algorithm. It is faster than the first fit and
  13560. helps minimize fragmentation.
  13561.  
  13562.  In either case, if the FCB function calls are used instead of the handle
  13563. function calls, the file will be broken into pieces starting with the first
  13564. available space on the disk.
  13565.  
  13566.  
  13567.  
  13568.  
  13569. BIOS Disk Routines .................................................... 8**16
  13570.  
  13571. ┌─────────────────────────────────────────────────────────────────────────────┐
  13572. │Interrupt 13h  Disk I/O - access the disk drives (floppy and hard disk)      │
  13573. └─────────────────────────────────────────────────────────────────────────────┘
  13574. (0:004Ch)    1) These calls do not try rereading disk if an error is returned.
  13575.              2) In the IBM OS/2 Tech Ref Volume 1, page 7-33, under "DOS
  13576.                 Environment Software Interrupt Support", it lists:
  13577.                 13h  disk/diskette     for non-removable media only, these
  13578.                                        functions are supported:
  13579.                                        01h     read status
  13580.                                        02h     read sectors
  13581.                                        0Ah     read long
  13582.                                        15h     read DASD (disk) type
  13583.              3) On hard disk systems these calls may be vectored through the
  13584.                 int 40h hard disk BIOS.
  13585.  
  13586.  
  13587. Function 00h    Reset - reset the disk controller chip
  13588. entry   AH      00h
  13589.         DL      drive (if bit 7 is set both hard disks and floppy disks reset)
  13590.                 00h-7Fh  floppy disk
  13591.                 80h-0FFh hard disk
  13592. return  AH      status (see 01h below)
  13593. note 1) Forces controller chip to recalibrate read/write heads.
  13594.      2) Some systems (Sanyo 55x, Columbia MPC) this resets all drives.
  13595.      3) This function should be called after a failed floppy disk Read, Write,
  13596.         Verify, or Format request before retrying the operation.
  13597.      4) If called with DL >= 80h (i.e., selecting a hard drive), the floppy
  13598.         controller and then the hard disk controller are reset.
  13599.      5) Function 0Dh allows the hard disk controller to be reset without
  13600.         affecting the floppy controller.
  13601.  
  13602.  
  13603. Function 01h    Get Status of Disk System
  13604. entry   AH      01h
  13605.         DL      drive (hard disk if bit 7 set)
  13606.                 00h-7Fh  floppy disk
  13607.                 80h-0FFh hard disk
  13608. return  AH      00h
  13609.         AL      status of most recent disk operation
  13610.                 00h     successful completion, no errors
  13611.                 01h     bad command
  13612.                 02h     address mark not found
  13613.                 03h     tried to write on write-protected disk    (floppy only)
  13614.                 04h     sector not found
  13615.                 05h     reset failed                                (hard disk)
  13616.                 06h     diskette removed or changed               (floppy only)
  13617.                 07h     bad parameter table                         (hard disk)
  13618.                 08h     DMA overrun                               (floppy only)
  13619.                 09h     attempt to DMA across 64K boundary
  13620.                 0Ah     bad sector detected                         (hard disk)
  13621.                 0Bh     bad track detected                          (hard disk)
  13622.                 0Ch     unsupported track or media type not found (floppy disk)
  13623.                 0Dh     invalid number of sectors on format         (hard disk)
  13624.                 0Eh     control data address mark detected          (hard disk)
  13625.                 0Fh     DMA arbitration level out of range          (hard disk)
  13626.                 10h     uncorrectable CRC/EEC on read
  13627.                 11h     ECC corrected data error                    (hard disk)
  13628.                 20h     controller failure
  13629.                 40h     seek failed
  13630.                 80h     timeout
  13631.                 0AAh    drive not ready                             (hard disk)
  13632.                 0BBh    undefined error                             (hard disk)
  13633.                 0CCh    write fault                                 (hard disk)
  13634.                 0E0h    status error                                (hard disk)
  13635.                 0FFh    sense operation failed                      (hard disk)
  13636. note 1) For hard disks, error code 11h (ECC data error) indicates that a
  13637.         recoverable error was detected during a preceding int 13h fn 02h
  13638.         (Read Sector) call.
  13639.  
  13640.  
  13641. Function 02h    Read Sectors - read one or more sectors from diskette
  13642. entry   AH      02h
  13643.         AL      number of sectors to read
  13644.         BX      address of buffer (ES=segment)
  13645.         CH      track (cylinder) number (0-39 or 0-79 for floppies)
  13646.                 (for hard disk, bits 8,9 in high bits of CL)
  13647.         CL      sector number (1 to 18, not value checked)
  13648.         DH      head number (0 or 1)
  13649.         DL      drive (0=A, 1=B, etc.) (bit 7=0)  (drive 0-7)
  13650.                 00h-7Fh   floppy disk
  13651.                 80h-FF0h  hard disk
  13652.         ES:BX   address to store/fetch data  (buffer to fill)
  13653.        [0000:0078]  dword pointer to diskette parameters
  13654. return  CF      clear   successful
  13655.                         AL      number of sectors transferred
  13656.                 set     error
  13657.                         AH      status  (00h, 02h, 03h, 04h, 08h, 09h, 10h,
  13658.                                          0Ah, 20h, 40h, 80h)
  13659. note 1) Number of sectors begins with 1, not 0.
  13660.      2) Trying to read zero sectors is considered a programming error; results
  13661.         are not defined.
  13662.      3) For hard disks, the upper 2 bits of the 10-bit cylinder number are
  13663.         placed in the upper 2 bits of register CL.
  13664.      4) For hard disks, error code 11h indicates that a read error occurred
  13665.         that was corrected by the ECC algorithm; in this case, AL contains the
  13666.         burst length. The data read is good within the limits of the ECC code.
  13667.         If a multisector transfer was requested, the operation was terminated
  13668.         after the sector containing the read error.
  13669.      5) For floppy drives, an error may result from the drive motor being off
  13670.         at the time of the request. The BIOS does not automatically wait for
  13671.         the drive to come up to speed before attempting the read operation. The
  13672.         calling program should reset the floppy disk system with function 00h
  13673.         and retry the operation three times before assuming that the error
  13674.         results from some other cause.
  13675.  
  13676.  
  13677. Function 03h    Write Sectors - write from memory to disk
  13678. entry   AH      03h
  13679.         AL      number of sectors to write (1-8)
  13680.         CH      track number (for hard disk, bits 8,9 in high bits of CL)
  13681.         CL      beginning sector number
  13682.                 (if hard disk, high two bits are high bits of track #)
  13683.         DH      head number  (head 0=0)
  13684.         DL      drive number (0-7)
  13685.                 00h-7Fh   floppy disk
  13686.                 80h-FF0h  hard disk
  13687.         ES:BX   address of buffer for data
  13688. return  CF      clear   success
  13689.                         AL      number of sectors written
  13690.                 set     error
  13691.                         AH      status (see 01h above)
  13692. note 1) Number of sectors begins with 1, not 0.
  13693.      2) Trying to write zero sectors is considered a programming error; results
  13694.         are not defined.
  13695.      3) For hard disks, the upper 2 bits of the 10-bit cylinder number are
  13696.         placed in the upper 2 bits of register CL.
  13697.      4) For floppy drives, an error may result from the drive motor being off
  13698.         at the time of the request. The BIOS does not automatically wait for
  13699.         the drive to come up to speed before attempting the read operation. The
  13700.         calling program should reset the floppy disk system with function 00h
  13701.         and retry the operation three times before assuming that the error
  13702.         results from some other cause.
  13703.  
  13704.  
  13705. Function 04h    Verify - verify that a write operation was successful
  13706. entry   AH      04h
  13707.         AL      number of sectors to verify (1-8)
  13708.         CH      track number  (for hard disk, bits 8,9 in high bits of CL)
  13709.         CL      beginning sector number
  13710.         DH      head number
  13711.         DL      drive number (0-7)
  13712.         DL      drive number (0-7)
  13713.                 00h-7Fh   floppy disk
  13714.                 80h-FF0h  hard disk
  13715.         ES:BX   address of buffer for data
  13716. return  CF      set on error
  13717.                 AH      status (see 01h above)
  13718.         AL      number of sectors verified
  13719. note 1) With IBM PC, XT, and AT with ROM BIOS earlier than 11/15/85, ES:BX
  13720.         should point to a valid buffer.
  13721.      2) For hard disks, the upper 2 bits of the 10-bit cylinder number are
  13722.         placed in the upper 2 bits of register CL.
  13723.      3) This function can be used to test whether a readable media is in a
  13724.         floppy drive. An error may result from the drive motor being off at the
  13725.         time of the request since the BIOS does not automatically wait for the
  13726.         drive to come up to speed before attempting the verify operation. The
  13727.         requesting program should reset the floppy disk system with function
  13728.         00h and retry the operation three times before assuming that a readable
  13729.         disk is not present.
  13730.  
  13731.  
  13732. Function 05h    Format Track - write sector ID bytes for 1 track (floppy disk)
  13733. entry   AH      05h
  13734.         AL      number of sectors to create on this track
  13735.                 interleave (for XT hard disk only)
  13736.         CH      track (or cylinder) number (bits 8,9 in high bits of CL)
  13737.         CL      sector number
  13738.         DH      head number (0, 1)
  13739.         DL      drive number (0-3)
  13740.                 00h-7Fh   floppy disk
  13741.                 80h-0FFh  hard disk
  13742.         ES:BX   pointer to 4-byte address field (C-H-R-N) (except XT hard disk)
  13743.                 byte 1 = (C) cylinder or track
  13744.                 byte 2 = (H) head
  13745.                 byte 3 = (R) sector
  13746.                 byte 4 = (N) bytes/sector (0 = 128, 1 = 256, 2 = 512, 3 = 1024)
  13747. return  CF      set if error occurred
  13748.                 AH      status code (see 01h above)
  13749. note 1) Not valid for ESDI hard disks on PS/2.
  13750.      2) For floppy disks, the number of sectors per track is taken from the
  13751.         BIOS floppy disk parameter table whose address is stored in the vector
  13752.         for int 1Eh.
  13753.      3) When this function is used for floppies on ATs or the PS/2, it should
  13754.         be preceded by a call to int 13h/fn 17h to select the type of media to
  13755.         format.
  13756.      4) For hard disks, the upper 2 bits of the 10-bit cylinder number are
  13757.         placed in the upper 2 bits of CL.
  13758.      5) On the XT/286, AT, and PS/2 hard disks, ES:BX points to a 512-byte
  13759.         buffer containing byte pairs for each physical disk sector as follows:
  13760.         Byte  Contents
  13761.         0       00h     good sector
  13762.                 80h     bad sector
  13763.         1       sector number
  13764.         For example, to format a track with 17 sectors and an interleave of
  13765.         two, ES:BX would point to the following 34-byte array at the beginning
  13766.         of a 512-byte buffer:
  13767.         db      00h, 01h, 00h, 0Ah, 00h, 02h, 00h, 0Bh, 00h, 03h, 00h, 0Ch
  13768.         db      00h, 04h, 00h, 0Dh, 00h, 05h, 00h, 0Eh, 00h, 06h, 00h, 0Fh
  13769.         db      00h, 07h, 00h, 10h, 00h, 08h, 00h, 11h, 00h, 09h
  13770.  
  13771.  
  13772. Function 06h    Hard Disk - format track and set bad sector flags
  13773.                                                      (PC2, PC-XT, and Portable)
  13774. entry   AH      06h
  13775.         AL      interleave value (XT only)
  13776.         CH      cylinder number (bits 8,9 in high bits of CL)
  13777.         CL      sector number
  13778.         DH      head
  13779.         DL      drive (80h-0FFh for hard disk)
  13780.         ES:BX   512 byte format buffer
  13781.                 the first 2*(sectors/track) bytes contain f,n for each sector
  13782.                 f       00h     good sector
  13783.                         80h     bad sector
  13784.                 n       sector number
  13785. return  CF      error
  13786.                 AH      status code (see 01h above)
  13787.  
  13788.  
  13789. Function 07h    Hard Disk - format the drive starting at the desired track
  13790.                                                       (PC2, PC-XT and Portable)
  13791. entry   AH      07h
  13792.         AL      interleave value (XT only) (01h-10h)
  13793.         CH      cylinder number (bits 8,9 in high bits of CL) (00h-03FFh)
  13794.         CL      sector number
  13795.         DH      head number (0-7)
  13796.         DL      drive number (80h-0FFh, 80h=C, 81h=D,...)
  13797.         ES:BX   format buffer, size = 512 bytes
  13798.                 the first 2*(sectors/track) bytes contain f,n for each sector
  13799.                 f       00h     good sector
  13800.                         80h     bad sector
  13801.                 n       sector number
  13802. return  CF      set on error
  13803.         AH      status code (see 01h above)
  13804. note    Award AT BIOS routines are extended to handle more than 1024 cylinders.
  13805.         AL      number of sectors
  13806.         CH      cylinder numberm low 8 bits
  13807.         CL      sector number bits 0-5, bits 6-7 are high 2 cylinder bits
  13808.         DH      head number (bits 0-5) bits 6-7 are extended high cyls (>1024)
  13809.         DL      drive number (0-1 for diskette, 80h-81h for hard disk)
  13810.         ES:BX   transfer address
  13811.  
  13812.  
  13813. Function 08h    Read Drive Parameters                          (except PC, Jr)
  13814. entry   AH      08h
  13815.         DL      drive number
  13816.                 00h-7Fh   floppy disk
  13817.                 80h-0FFh  hard disk
  13818. return  CF      set on error
  13819.                 AH      status code (see above)
  13820.         BL      drive type  (AT/PS2 floppies only)
  13821.                 01h     if 360 Kb, 40 track, 5¼"
  13822.                 02h     if 1.2 Mb, 80 track, 5¼"
  13823.                 03h     if 720 Kb, 80 track, 3½"
  13824.                 04h     if 1.44 Mb, 80 track, 3½"
  13825.         CH      low 8 bits of maximum useable value for cylinder number
  13826.         CL bits 6-7     high-order 2 bits of maximum cylinder number
  13827.                 0-5     maximum sector number
  13828.         DH      maximum usable value for head number
  13829.         DL      number of consecutive acknowledging drives (0-2)
  13830.         ES:DI   pointer to drive parameter table
  13831. note 1) On the PC and PC/XT, this function is supported on hard disks only.
  13832.      2) The Columbia MPC supports functions 6-14 for its hard disk. It returns
  13833.         drive information, same as int 13 function 8, except that the BL and
  13834.         ES:DI values are omitted and AL <- burst length.
  13835.  
  13836.  
  13837. Function 09h    Initialize Two Fixed Disk Base Tables    (XT, AT, XT/286, PS/2)
  13838.                 (install nonstandard drive)
  13839. entry   AH      09h
  13840.         DL      80h-0FFh  hard disk number
  13841. return  CF      set on error
  13842.                 AH      status code (see 01h above)
  13843.                 For PC, XT hard disks, the disk parameter block format is:
  13844.                 00h-01h maximum number of cylinders
  13845.                 02h     maximum number of heads
  13846.                 03h-04h starting reduced write current cylinder
  13847.                 05h-06h starting write precompensation cylinder
  13848.                 07h     maximum ECC burst length
  13849.                 08h     drive options
  13850.                    bits 7       1       disable disk access retries
  13851.                         6       1       disable ECC retries
  13852.                         3-5     set to 0
  13853.                         0-2     drive option
  13854.                 09h     standard timeout value
  13855.                 0Ah     timeout value for format drive
  13856.                 0Bh     timeout value for check drive
  13857.                 0Ch-0Fh reserved
  13858.  
  13859.                 For AT and PS/2 hard disks:
  13860.                 00h-01h maximum number of cylinders
  13861.                 02h     maximum number of heads
  13862.                 03h-04h reserved
  13863.                 05h-06h starting write precompensation cylinder
  13864.                 07h     maximum ECC burst length
  13865.                 08h     drive options byte
  13866.                    bits 6-7     nonzero (10, 01, or 11) if retries disabled
  13867.                         5       1       if manufacturer's defect map present at
  13868.                                         maximum cylinder + 1
  13869.                         4       not used
  13870.                         3       1       if more than 8 heads
  13871.                         0-2     not used
  13872.                 09h-0Bh reserved
  13873.                 0Ch-0Dh landing zone cylinder
  13874.                 0Eh     sectors per track
  13875.                 0Fh     reserved
  13876. note 1) For the XT, int 41h must point to the Disk Parameter Block.
  13877.      2) For the AT and PS/2, int 41h points to table for drive 0 and int 46h
  13878.         points to table for drive 1.
  13879.      3) Initializes the hard disk controller for subsequent I/O operations
  13880.         using the values found in the BIOS disk parameter block(s).
  13881.      4) This function is supported on hard disks only.
  13882.  
  13883.  
  13884. Function 0Ah    Read Long   (Hard disk)                 (XT, AT, XT/286, PS/2)
  13885. entry   AH      0Ah
  13886.         CH      cylinder number (bits 8,9 in high bits of CL)
  13887.         CL      sector number (upper 2 bits of cyl # in upper 2 bits of CL)
  13888.         DH      head number
  13889.         DL      drive ID  (80h-0FFh hard disk)
  13890.         ES:BX   pointer to buffer to fill
  13891. return  CF      set on error
  13892.                 AH      status code (see 01h above)
  13893.         AL      number of sectors actually transferred
  13894. note 1) A "long" sector includes a 4 byte EEC (Extended Error Correction) code.
  13895.      2) Used for diagnostics only on PS/2 systems.
  13896.      3) This function is supported on fixed disks only.
  13897.      4) Unlike the normal Read Sector (02h) function, ECC errors are not
  13898.         automatically corrected. Multisector transfers are terminated after any
  13899.         sector with a read error.
  13900.  
  13901.  
  13902. Function 0Bh    Write Long                              (XT, AT, XT/286, PS/2)
  13903. entry   AH      0Bh
  13904.         AL      number of sectors
  13905.         CH      cylinder (bits 8,9 in high bits of CL)
  13906.         CL      sector number
  13907.         DH      head number
  13908.         DL      drive ID  (80h-0FFh hard disk)
  13909.         ES:BX   pointer to buffer containing data
  13910. return  CF      set on error
  13911.                 AH      status code (see 01h above)
  13912.         AL      number of sectors actually transferred
  13913. note 1) A "long" sector includes a 4 byte EEC (Extended Error Correction) code.
  13914.      2) Used for diagnostics only on PS/2 systems.
  13915.      3) Valid for hard disks only.
  13916.  
  13917.  
  13918. Function 0Ch    Seek To Cylinder                        (except PC, PCjr)
  13919. entry   AH      0Ch
  13920.         CH      lower 8 bits of cylinder
  13921.         CL      upper 2 bits of cylinder in bits 6-7
  13922.         DH      head number
  13923.         DL      drive number (0 or 1)  (80h-0FFh for hard disk)
  13924. return  CF      set on error
  13925.                 AH      status code (see 01h above)
  13926. note 1) Positions heads over a particular cylinder, but does not move any data.
  13927.      2) This function is supported on hard disks only.
  13928.      3) The upper 2 bits of the 10-bit cylinder number are placed in the upper
  13929.         2 bits of CL.
  13930.      4) The Read Sector, Read Sector Long, Write Sector, and Write Sector Long
  13931.         functions include an implied seek operation and need not be preceded by
  13932.         an explicit call to this function.
  13933.  
  13934.  
  13935. Function 0Dh    Alternate Hard Disk Reset                    (except PC, PCjr)
  13936. entry   AH      0Dh
  13937.         DL      hard drive number (80h-0FFh hard disk)
  13938. return  CF      set on error
  13939.                 AH      status code (see 01h above)
  13940. note 1) Not for PS/2 ESDI hard disks.
  13941.      2) Resets the hard disk controller, recalibrates attached drives (moves
  13942.         the read/write arm to cylinder 0), and prepares for subsequent disk I/O.
  13943.      3) This function is for hard disks only. It differs from fn 00h by not
  13944.         resetting the floppy disk controller.
  13945.  
  13946.  
  13947. Function 0Eh    Read Sector Buffer                         (XT, Portable, PS/2)
  13948. entry   AH      0Eh
  13949.         ES:BX   pointer to buffer
  13950. return  CF      set on error
  13951.                 AH      status code (see 01h above)
  13952.         AL      number of sectors actually transferred
  13953. note 1) Transfers controller's sector buffer. No data is read from the drive.
  13954.      2) Used for diagnostics only on PS/2 systems.
  13955.      3) This fn is supported by the XT's hard disk adapter only. It is "not
  13956.         defined" for hard disk adapters on the AT or PS/2.
  13957.  
  13958.  
  13959. Function 0Fh    Write sector buffer                          (XT, Portable)
  13960. entry   AH      0Fh
  13961.         ES:BX   pointer to buffer
  13962. return  CF      set if error
  13963.                 AH      status code (see 01h above)
  13964.         AL      number of sectors actually transferred
  13965. note 1) Should be called before formatting to initialize the controller's
  13966.         sector buffer.
  13967.      2) Used for diagnostics only on PS/2 systems.
  13968.      3) Transfers data from system RAM to the hard disk adapter's internal
  13969.         sector buffer.
  13970.      4) No data is written to the physical disk drive.
  13971.      5) This fn is for the XT hard disk controller only. It is "not defined"
  13972.         for AT or PS/2 controllers.
  13973.  
  13974.  
  13975. Function 10h    Test For Drive Ready                  (XT, AT, XT/286, PS/2)
  13976. entry   AH      10h
  13977.         DL      hard drive number 0 or 1 (80h-0FFh)
  13978. return  CF      set on error
  13979.                 AH      status code (see 01h above)
  13980. note 1) Tests whether the specified hard disk drive is operational and returns
  13981.         the drive's status.
  13982.      2) This function is supported on hard disks only.
  13983.      3) Perstor and Novell controllers allow more than one controller. Does
  13984.         not work for multiple Perstor controllers. (reports first two drives
  13985.         only).
  13986.      4) Does not work with network drives.
  13987.  
  13988.  
  13989. Function 11h    Recalibrate Drive                      (XT, AT, XT/286, PS/2)
  13990. entry   AH      11h
  13991.         DL      hard drive number (80h-0FFh hard disk)
  13992. return  CF      set on error
  13993.                 AH      status code (see 01h above)
  13994. note 1) Causes the HD controller to recalibrate itself for the specified drive,
  13995.         positioning the read/arm to cylinder 0, and returns the drive's status.
  13996.      2) This function is for hard disks only.
  13997.  
  13998.  
  13999. Function 12h    Controller RAM Diagnostics                (XT, Portable, PS/2)
  14000. entry   AH      12h
  14001. return  CF      set on error
  14002.                 AH      status code (see fn 01h above)
  14003. note 1) Used for diagnostics only on PS/2 systems.
  14004.      2) Makes the hard disk controller carry out a built-in diagnostic test on
  14005.         its internal sector buffer.
  14006.  
  14007.  
  14008. Function 13h    Controller Drive Diagnostic               (XT, Portable, PS/2)
  14009. entry   AH      13h
  14010. return  CF      set on error
  14011.                 AH      status code (see 01h above)
  14012. note 1) Used for diagnostics only on PS/2 systems.
  14013.      2) Causes HD controller to run internal diagnostic tests of the attached
  14014.         drive, indicating whether the test was passed by the returned status.
  14015.      3) This function is supported on XT HDs only.
  14016.  
  14017.  
  14018. Function 14h    Controller Internal Diagnostic               (AT, XT/286)
  14019. entry   AH      14h
  14020. return  CF      set on error
  14021.         AH      status code (see 01h above)
  14022. note 1) OEM is Western Digital 1003-WA2 hard/floppy combination controller
  14023.         in AT and XT/286.
  14024.      2) Used for diagnostics only in PS/2 systems.
  14025.      3) Causes HD controller to do a built-in diagnostic self-test, indicating
  14026.         whether the test was passed by the returned status.
  14027.      4) This function is supported on hard disks only.
  14028.  
  14029.  
  14030. Function 15h    Get Disk Type                                (except PC and XT)
  14031. entry   AH      15h
  14032.         DL      drive ID
  14033.                 00h-7Fh   floppy disk
  14034.                 80h-0FFh  fixed disk
  14035. return  CF      set on error
  14036.                 AH      error code (see 01h above)
  14037.         AH      disk type
  14038.                 00h     no drive is present
  14039.                 01h     diskette, no change detection present
  14040.                 02h     diskette, change detection present
  14041.                 03h     hard disk
  14042.                         CX:DX   number of 512-byte sectors
  14043. note 1) Returns a code indicating the type of disk referenced by the specified
  14044.         drive code.
  14045.      2) This function is not supported on the PC or XT.
  14046.  
  14047.  
  14048. Function 16h    Get Disk Change Status (diskette)      (except PC, XT, & Jr)
  14049. entry   AH      16h
  14050.         DL      drive to check
  14051. return  CF      set on error
  14052.         AH      disk change status
  14053.                 00h     no disk change
  14054.                 01h     disk changed
  14055.         DL      drive that had disk change (00h-07Fh floppy disk)
  14056. note    Returns the status of the change line, indicating whether the disk in
  14057.         the drive may have been replaced since the last disk access. If this
  14058.         function returns with CF set, the disk has not necessarily been
  14059.         changed; the change line can be activated by simply unlocking and
  14060.         relocking the disk drive door without removing the floppy disk.
  14061.  
  14062.  
  14063. Function 17h    Set Disk Type for Format (diskette)          (except PC and XT)
  14064. entry   AH      17h
  14065.         AL      00h     not used
  14066.                 01h     160, 180, 320, or 360Kb diskette in 360kb drive
  14067.                 02h     360Kb diskette in 1.2Mb drive
  14068.                 03h     1.2Mb diskette in 1.2Mb drive
  14069.                 04h     720Kb diskette in 720Kb drive
  14070.         DL      drive number (0-7)
  14071. return  CF      set on error
  14072.         AH      status of operation (see 01h above)
  14073. note 1) This function is probably enhanced for the PS/2 series to detect
  14074.         1.44 in 1.44 and 720k in 1.44.
  14075.      2) This function is not supported for floppy disks on the PC or XT.
  14076.      3) If the change line is active for the specified drive, it is reset.
  14077.      4) The BIOS sets the data rate for the specified drive and media type.
  14078.         The rate is 250k/sec for double-density media and 500k/sec for high
  14079.         density media. The proper hardware is required.
  14080.  
  14081.  
  14082. Function 18h    Set Media Type For Format  (diskette)   (AT, XT2, XT/286, PS/2)
  14083. entry   AH      18h
  14084.         CH      lower 8 bits of number of tracks
  14085.         CL      high 2 bits of number of tracks (6,7) sectors per track
  14086.                 (bits 0-5)
  14087.         DL      drive number (0-7)
  14088. return  CF      clear   no errors
  14089.         AH      00h      if requested combination supported
  14090.                 01h      if function not available
  14091.                 0Ch      if not suppported or drive type unknown
  14092.                 80h      if there is no media in the drive
  14093.         ES:DI   pointer to 11-byte disk parameter table for media type
  14094.         CF      set     error code (see 01h above)
  14095. note 1) A floppy disk must be present in the drive.
  14096.      2) This function should be called prior to formatting a disk with Int 13h
  14097.         Fn 05h so the BIOS can set the correct data rate for the media.
  14098.      3) If the change line is active for the specified drive, it is reset.
  14099.  
  14100.  
  14101. Function 19h    Park Hard Disk Heads                         (PS/2)
  14102. entry   AH      19h
  14103.         DL      drive number (80h-0FFh)
  14104. return  CF      set on error
  14105.                 AH      error code (see fn 01h)
  14106. note    This function is defined for PS/2 fixed disks only.
  14107.  
  14108.  
  14109. Function 1Ah    ESDI Hard Disk - Low Level Format                      (PS/2)
  14110. entry   AH      1Ah
  14111.         AL      Relative Block Address (RBA) defect table count
  14112.                 00h     no errors on disk
  14113.                 01h+    number of disk errors
  14114.         CL      format modifiers byte
  14115.            bits 0       ignore primary defect map
  14116.                 1       ignore secondary defect map
  14117.                 2       update secondary defect map
  14118.                 3       perform extended surface analysis
  14119.                 4       generate periodic interrupt after each cylinder format
  14120.                 5       reserved - must be 0
  14121.                 6       reserved - must be 0
  14122.                 7       reserved - must be 0
  14123.         DL      drive  (80h-0FFh)
  14124.         ES:BX   pointer to RBA defect table
  14125. return  CF      set on error
  14126.                 AH      error code (see fn 01h above)
  14127. note 1) Initializes disk sector and track address fields on a drive attached
  14128.         to the IBM "ESDI Fixed Disk Drive Adapter/A."
  14129.      2) If periodic interrupt selected, int 15h/fn 0Fh is called after each
  14130.         cylinder is formatted
  14131.      3) If bit 4 of CL is set, Int 15h, AH=0Fh, AL=phase code after each
  14132.         cylinder is formatted or analyzed. The phase code is defined as:
  14133.         0       reserved
  14134.         1       surface analysis
  14135.         2       formatting
  14136.      4) If bit 2 of CL is set, the drive's secondary defect map is updated to
  14137.         reflect errors found during surface analysis. If both bit 2 and bit 1
  14138.         are set, the secondary defect map is replaced.
  14139.      5) For an extended surface analysis, the disk should first be formatted by
  14140.         calling this function with bit 3 cleared and then analyzed by calling
  14141.         this function with bit 3 set.
  14142.  
  14143.  
  14144. Function 1Bh    ESDI Hard Disk - Get Manufacturing Header       (PS/2)
  14145. entry   AH      1Bh
  14146.         AL      number of record
  14147.         DL      drive
  14148.         ES:BX   pointer to buffer for manufacturing header (defect list)
  14149. return  CF      set on error
  14150.         AH      status
  14151. note    Manufacturing header format (Defect Map Record format) can be found
  14152.         in the "IBM 70Mb, 115Mb Fixed Disk Drives Technical Reference."
  14153.  
  14154.  
  14155. Function 1Ch    ESDI Hard Disk - Get Configuration                  (PS/2)
  14156. entry   AH      1Ch
  14157.         AL      0Ah     Get Device Configuration
  14158.                         DL      drive
  14159.                         ES:BX   pointer to buffer for device configuration
  14160.                                 (drive physical parameter)
  14161.                 0Bh     Get Adapter Configuration
  14162.                         ES:BX   pointer to buffer for adapter configuration
  14163.                 0Ch     Get POS Information
  14164.                         ES:BX   pointer to POS information
  14165.                 0Dh     unknown
  14166.                 0Eh     Translate RBA to ABA
  14167.                         CH      low 8 bits of cylinder number
  14168.                         CL      sector number, high two bits of cylinder number
  14169.                                 in bits 6 and 7
  14170.                         DH      head number
  14171.                         DL      drive number
  14172.                         ES:BX   pointer to ABA number
  14173.  
  14174. return  CF      set on error
  14175.                 AH      status (see 01h)
  14176. note 1) Device configuration format can be found in IBM ESDI Fixed Disk Drive
  14177.         Adapter/A Technical Reference.
  14178.      2) ABA (absolute block address) format can be found in IBM ESDI Adapter
  14179.         Technical Reference by using its Device Configuration Status Block.
  14180.  
  14181.  
  14182. Function 1Dh    IBMCACHE.SYS                                (PS/2 50+)
  14183. entry   AH      1Dh
  14184. other parameters unknown
  14185. note    IBMCACHE.SYS comes on the setup disk for MCA-bus PS/2 machines.
  14186.  
  14187.  
  14188. Function 20h    Western Digital HD SuperBIOS
  14189. entry   AH      20h
  14190. other parameters unknown
  14191. note    SuperBIOS may be purchased separately from Western Digital and added
  14192.         to standard HD controllers. SuperBIOS contains additional setup
  14193.         tables and parameters.
  14194.  
  14195.  
  14196.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  14197.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  14198. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  14199.                      ISBN 1-878830-02-3 (disk-based text)
  14200.                     Copyright (c) 1987, 1992 Dave Williams
  14201.                         ┌─────────────────────────────┐
  14202.                         │ Shareware Version, 03/16/92 │
  14203.                         │  Please Register Your Copy  │
  14204.                         └─────────────────────────────┘
  14205.  
  14206.  
  14207.                             C H A P T E R   N I N E
  14208.  
  14209.  
  14210.                           INSTALLABLE DEVICE DRIVERS
  14211.  
  14212.  
  14213.                                 C O N T E N T S
  14214.  
  14215. Device Driver Format .................................................... 9**
  14216. Types of Devices ........................................................ 9**
  14217.         Character Devices ............................................... 9**
  14218.         Block Devices ................................................... 9**
  14219. Device Header ........................................................... 9**
  14220.         Pointer to Next Device Header Field ............................. 9**
  14221.         Attribute Field ................................................. 9**
  14222.                 Bits 0 and 1 ............................................ 9**
  14223.                 Bit 2 ................................................... 9**
  14224.                 Bit 3 ................................................... 9**
  14225.                 Bit 13 .................................................. 9**
  14226.                 Bit 14 .................................................. 9**
  14227.                 Bit 15 .................................................. 9**
  14228.         Pointer to Strategy and Interrupt Routines ...................... 9**
  14229.         Name/Unit Field ................................................. 9**
  14230. Creating a Device Driver ................................................ 9**
  14231. Installing Device Drivers ............................................... 9**
  14232.         Installing Character Devices .................................... 9**
  14233.         Installing Block Devices ........................................ 9**
  14234. Request Header .......................................................... 9**
  14235.         Unit Code Field ................................................. 9**
  14236.         Command Code Field .............................................. 9**
  14237.         Status Field .................................................... 9**
  14238. Device Driver Functions ................................................. 9**
  14239.         INIT ............................................................ 9**
  14240.         MEDIA CHECK ..................................................... 9**
  14241.         Media Descriptor Byte ........................................... 9**
  14242.         BUILD BPB (BIOS Parameter Block) ................................ 9**
  14243.         INPUT OR OUTPUT ................................................. 9**
  14244.         NONDESTRUCTIVE INPUT NO WAIT .................................... 9**
  14245.         STATUS .......................................................... 9**
  14246.         FLUSH ........................................................... 9**
  14247.         OPEN or CLOSE (DOS 3.0+) ........................................ 9**
  14248.         REMOVEABLE MEDIA (DOS 3.0+) ..................................... 9**
  14249. The CLOCK$ Device ....................................................... 9**
  14250.  
  14251.  
  14252.  
  14253.  
  14254. DEVICE DRIVER FORMAT├──────────────────────────────────────────────────────────
  14255.  
  14256.  A device driver is a handler for communication between the system software
  14257. and hardware devices. The motherboard ROM and IBMBIO.COM or IO.SYS files
  14258. contain the basic drivers for allowing DOS to talk to the console, disk drives,
  14259. serial and parallel ports, clock, and other resources.
  14260.  
  14261.  DOS has five builtin drivers, STDIN, STDOUT, STERR, STDPRN, or STDAUX. An
  14262. "installable" driver may be loaded in the CONFIG.SYS file, and either replace
  14263. one of the builtin drivers or define a new resource, such as a mouse or
  14264. expanded memory driver.
  14265.  
  14266.  The device driver is a COM (memory image) file that contains all of the code
  14267. needed to control an add-in device. An EXE file should not be used since the
  14268. EXE loader in some DOS 2.x versions is part of COMMAND.COM, which is not
  14269. present when the device driver is being loaded by IBMBIO.COM or IO.SYS. EXE
  14270. format drivers could be used in DOS 3.x+, but there is generally no reason to
  14271. do so. The COM file must not load at the usual ORG 100h. Since the driver does
  14272. not use the Program Segment Prefix, it is simply loaded without offset,
  14273. therefore the driver file must have an origin of 0. Most references advise
  14274. "ORG 0 or no ORG statement", however with the advent of many new assemblers on
  14275. the market, some of which default to .COM files, specifically stating "ORG 0"
  14276. may eliminate problems. Driver files should not have a declared stack segment.
  14277.  
  14278.  DOS can install the device driver anywhere in memory, so care must be taken
  14279. in any FAR memory references. You should not expect that your driver will be
  14280. loaded in the same place every time.
  14281.  
  14282.  
  14283.  
  14284.  
  14285. TYPES OF DEVICES├──────────────────────────────────────────────────────────────
  14286.  
  14287.  There are two types of devices: Character devices and Block devices. Their
  14288. attributes are as follows:
  14289.  
  14290.  Character devices are designed to do serial I/O in a byte-by-byte manner.
  14291. These devices have names like CON, AUX, or PRN, and you can open channels
  14292. (handles or FCBs) to do I/O much like a disk file. I/O may be in either cooked
  14293. or raw mode. (see Chapter 7 for discussion of cooked and raw modes). Because
  14294. character devices have only one name, they can only support one device.
  14295.  
  14296.  Block devices are normally implemented as disk drives. They can do random I/O
  14297. in pieces called blocks, which are usually the physical sector size of the disk.
  14298. These devices are not named as character devices are, and cannot be opened
  14299. directly. Instead they are accessed by using drive letters such as A, B, C,
  14300. etc. Block devices can have units within them. In this way, a single block
  14301. driver can be responsible for one or more disk drives. For example, the first
  14302. block device driver can be responsible for drives A, B, C, and D. This means it
  14303. has four units defined and therefore takes up four drive letters. The position
  14304. of the driver in the chain of all drives determines the way in which the drive
  14305. letters correspond, i.e, if a second block device driver defines three units,
  14306. then those units are E, F, and G.
  14307.  
  14308.  DOS 1.x allows 16 block devices. DOS 2.x allows 63, and DOS 3.x allows 26. It
  14309. is recommended that drivers limit themselves to 26 devices for compatibility
  14310. with DOS 3.x and 4.x. When DOS 2.x passes the Z: drivespec, the drivespecs get
  14311. a little wierd, such as ^, [, or #. DOS 3.x+ will return an error message.
  14312.  
  14313.  
  14314.  
  14315.  
  14316. CREATING A DEVICE DRIVER├──────────────────────────────────────────────────────
  14317.  
  14318.  To create a device driver that DOS can install, you must do the following:
  14319.  
  14320. 1) Create a memory image (COM) file with a device header at the start of the
  14321.    file.
  14322. 2) Originate the code (including the device header) at 0, instead of 100h.
  14323. 3) Set the next device header field. Refer to "Pointer to Next Device Header
  14324.    Attribute Field" for more information.
  14325. 4) Set the attribute field of the device header. Refer to "Attribute Field" for
  14326.    more information.
  14327. 5) Set the entry points for the interrupt and strategy routines.
  14328. 6) Fill in the name/unit field with the name of the character device or the
  14329.    unit number of the block device.
  14330.  
  14331.  DOS always processes installable character device drivers before handling the
  14332. default devices. So to install a new CON device, simply name the device CON.
  14333. Be sure to set the standard input device and standard output device bits in
  14334. the attribute field of a new CON device. The scan of the device list stops on
  14335. the first match so the installable device driver takes precedence. For
  14336. instance, installing ANSI.SYS replaces the builtin CON driver.
  14337.  
  14338.  DOS doesn't care about the position of installed character devices versus
  14339. block devices.
  14340.  
  14341.  
  14342.  
  14343.  
  14344. STRUCTURE OF A DEVICE DRIVER├──────────────────────────────────────────────────
  14345.  
  14346.  A device driver consists of three major parts:
  14347.         a device header
  14348.         a strategy routine
  14349.         an interrupt routine
  14350.  
  14351.  
  14352. DEVICE HEADER
  14353.  
  14354.  The driver has a special header to identify it as a device and to define the
  14355. strategy and interrupt entry points and its various attributes. This header is
  14356. located at the beginning of the file. It contains a pointer to the next driver
  14357. in the chain, the attributes of the device, offsets into the strategy and
  14358. interrupt routines, and the device ID.
  14359.  
  14360.  This is the format of the device header:
  14361.  
  14362. ┌──────────────────────────────────────────────────────────────────────────────┐
  14363. │                         D E V I C E    H E A D E R                           │
  14364. ├───────┬────────┬─────────────────────────────────────────────────────────────┤
  14365. │Offset │ Length │                       Description                           │
  14366. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  14367. │  00h  │  word  │  Pointer to next device header field, offset value          │
  14368. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  14369. │  02h  │  word  │  Pointer to next device header field, segment value         │
  14370. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  14371. │  04h  │  word  │  Attribute                                                  │
  14372. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  14373. │  06h  │  word  │  Pointer to device strategy routine (offset only)           │
  14374. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  14375. │  08h  │  word  │  Pointer to device interrupt routine (offset only)          │
  14376. ├───────┼────────┼─────────────────────────────────────────────────────────────┤
  14377. │  0Ah  │8 bytes │  Name/Unit field                                            │
  14378. └───────┴────────┴─────────────────────────────────────────────────────────────┘
  14379.  
  14380.  
  14381. POINTER TO NEXT DEVICE HEADER FIELD
  14382.  
  14383.  The device header field is a pointer to the device header of the next device
  14384. driver. It is a doubleword field that is set by DOS at the time the device
  14385. driver is loaded. The first word is the offset and the second word is the
  14386. segment.
  14387.  
  14388.  If you are loading only one device driver, set the device header field to -1
  14389. before loading the device. If you are loading more than one device driver, set
  14390. the first word of the device driver header to the offset of the next device
  14391. driver's header. Set the device driver header field of the last device driver
  14392. to -1.
  14393.  
  14394.  
  14395. ATTRIBUTE FIELD
  14396.  
  14397.  The attribute field is a word field used to identify the type of device this
  14398. driver is responsible for. This field distinguishes between block and
  14399. character devices and determines is selected devices are given special
  14400. treatment. The attributes are:
  14401.  
  14402. ┌──────────────────────────────────────────────────────────────────────────────┐
  14403. │                        A T T R I B U T E   F I E L D                         │
  14404. ├──────────┬───────┬───────────────────────────────────────────────────────────┤
  14405. │   word   │ attr. │                                                           │
  14406. ├──────────┼───────┤                     description                           │
  14407. │   bits   │  set  │                                                           │
  14408. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  14409. │     0    │   0   │   not current standard input device                       │
  14410. │          │   1   │   current standard input device                           │
  14411. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  14412. │     1    │   0   │   not current standard output device                      │
  14413. │          │   1   │   current standard output device                          │
  14414. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  14415. │     2    │   0   │   not current NUL device                                  │
  14416. │          │   1   │   current NUL device                                      │
  14417. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  14418. │     3    │   0   │   not current CLOCK device                                │
  14419. │          │   1   │   current CLOCK device                                    │
  14420. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  14421. │     4    │   0   │   standard CON I/O routines should be used                │
  14422. │          │   1   │   fast screen I/O (int 29h) should be used                │
  14423. ├──────────┼───────┴───────────────────────────────────────────────────────────┤
  14424. │  5 - 10  │         "reserved for DOS" - unknown - should be set to 0         │
  14425. ├──────────┼───────┬───────────────────────────────────────────────────────────┤
  14426. │    11    │   0   │   doesn't support removeable media  (default for DOS 2.x) │
  14427. │          │   1   │   supports removeable media         (DOS 3.0+ only)       │
  14428. ├──────────┼───────┴───────────────────────────────────────────────────────────┤
  14429. │    12    │         "reserved for DOS" - unknown - should be set to 0         │
  14430. ├──────────┼───────┬───────────────────────────────────────────────────────────┤
  14431. │    13    │   0   │   IBM format       (block devices)                        │
  14432. │          │   1   │   non-IBM format   (block devices)                        │
  14433. │          │   1   │   output till busy (character devices)                    │
  14434. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  14435. │    14    │   0   │   doesn't support IOCTL                                   │
  14436. │          │   1   │   supports IOCTL                                          │
  14437. ├──────────┼───────┼───────────────────────────────────────────────────────────┤
  14438. │    15    │   0   │   block device                                            │
  14439. │          │   1   │   character device                                        │
  14440. └──────────┴───────┴───────────────────────────────────────────────────────────┘
  14441.  
  14442. note 1) If a bit in the attribute word is defined only for one type of device,
  14443.         a driver for the other type of device must set that bit to 0.
  14444.      2) For DOS 2.0 bits 4-12 must be off.
  14445.  
  14446.  
  14447. BIT 1   is the standard input and output bit. It is used for character devices
  14448.         only. Use this bit to tell DOS if your character device driver is the
  14449.         new standard input device or standard output device.
  14450.  
  14451. BIT 2   is the NUL attribute bit. It is used for character devices only. Use it
  14452.         to tell DOS if your character device driver is a NUL device. Although
  14453.         there is a NUL device attribute bit, you cannot reassign the NUL
  14454.         device or replace it with your own routine. This attribute exists for
  14455.         DOS so that DOS can tell if the NUL device is being used.
  14456.  
  14457. BIT 3   is the clock device bit. It is used for character devices only. Default
  14458.         is 0. You can use it to tell DOS if your character device driver is the
  14459.         new CLOCK device.
  14460.  
  14461. BIT 4   is the "fast video output" bit. The default is 0, which uses the BIOS
  14462.         for writing to the screen. When set, this bit uses int 29h for much
  14463.         faster screen updates.
  14464.  
  14465. BITS 5-10  reserved for DOS, unknown. Should be set to 0.
  14466.  
  14467. BIT 11  is the open/close removeable media bit. Use it to tell DOS if the
  14468.         device driver can handle removeable media. This bit is valid for DOS
  14469.         3.0+ only. This bit was reserved in DOS 2.x. Since DOS 2.x does not
  14470.         look at this bit, its use is backward compatible.
  14471.  
  14472. BIT 12  reserved for DOS, unknown. Should be set to 0.
  14473.  
  14474. BIT 13  is the non-IBM format bit. When used for block devices it affects the
  14475.         operation of the BUILD BPB (BIOS parameter block) device call. For
  14476.         character devices it indicates that the devices implements the OUTPUT
  14477.         UNTIL BUSY device call.
  14478.  
  14479. BIT 14  is the IOCTL bit. It is used for both character and block devices. Use
  14480.         it to tell DOS whether the device driver can handle control strings
  14481.         through the IOCTL function call 44h.
  14482.          If a device driver cannot process control strings, it should set bit
  14483.         14 to 0. This way DOS can return an error if an attempt is made through
  14484.         the IOCTL function call to send or receive control strings to the
  14485.         device. If a device can process control strings, it should set bit 14
  14486.         to 1. This way, DOS makes calls to the IOCTL input and output device
  14487.         function to send and receive IOCTL strings.
  14488.          The IOCTL functions allow data to be sent to and from the device
  14489.         without actually doing a normal read or write. In this way, the device
  14490.         driver can use the data for its own use, (for example, setting a baud
  14491.         rate or stop bits, changing form lengths, etc.) It is up to the device
  14492.         to interpret the information that is passed to it, but the information
  14493.         must not be treated as a normal I/O request.
  14494.  
  14495. BIT 15  is the device type bit. Use it to tell the system the that driver is a
  14496.         block or character device.
  14497.  
  14498.  
  14499. POINTER TO STRATEGY ROUTINE
  14500.  
  14501.  This field contains a pointer to "device strategy" function in the driver.
  14502. This function is called whenever a request is made to the driver, and must
  14503. store the location of the request header from DOS. This pointer is a word
  14504. value, and so must be in the same segment as the device header.
  14505.  
  14506.  
  14507. POINTER TO INTERRUPT ROUTINE
  14508.  
  14509.  This field contains a pointer to the function which activates driver routines
  14510. to perform the command in the current request header. This is called by DOS
  14511. after the call to the strategy function, and should reset to the request header
  14512. address stored by "strategy", to allow for the possibility of interrupts
  14513. between the two calls. This pointer is a word value, and so must be in the same
  14514. segment as the device header.
  14515.  
  14516.  
  14517. NAME/UNIT FIELD
  14518.  
  14519.  This is an 8-byte field that contains the name of a character device or the
  14520. number of units in a block device. For the character names, the name is
  14521. left-justified and the space is filled to 8 bytes. For block devices, the
  14522. number of units can be placed in the first byte. This is optional because DOS
  14523. fills in this location with the value returned by the driver's INIT code. The
  14524. other 7 bytes of the block device ID are reserved and should not be used.
  14525.  
  14526.  
  14527.  
  14528. INSTALLING DEVICE DRIVERS├─────────────────────────────────────────────────────
  14529.  
  14530.  DOS installs new device drivers dynamically at boot time by reading and
  14531. processing the DEVICE command in the CONFIG.SYS file. For example, if you have
  14532. written a device driver called RAMDISK, to install it put this command in the
  14533. CONFIG.SYS file:
  14534.                    DEVICE=[drive][path] RAMDISK [parameters]
  14535.  
  14536.  DOS makes a FAR call to the device driver at its strategy entry point first,
  14537. using the request header to pass information describing what DOS wants the
  14538. device driver to do.
  14539.  
  14540.  This strategy routine does not perform the request but rather queues the
  14541. request or saves a pointer to the request header. The second entry point is
  14542. the interrupt routine and is called by DOS immediately after the strategy
  14543. routine returns. The interrupt routine is called with no parameters. Its
  14544. function is to perform the operation based on the queued request and set up
  14545. any return infromation.
  14546.  
  14547.  DOS passes the pointer to the request header in ES:BX. This structure consists
  14548. of a fixed length header (Request Header) followed by data pertinent to the
  14549. operation to be performed.
  14550.  
  14551. NOTE: It is the responsibility of the device driver to preserve the machine
  14552.       state. For example, save all registers on entry and restore them on exit.
  14553.  
  14554.  The stack used by DOS has enough room on it to save all the registers. If more
  14555. stack space is needed, it is the device driver's responsibility to allocate and
  14556. maintain another stack.
  14557.  
  14558.  All calls to execute device drivers are FAR calls. FAR returns should be
  14559. executed to return to DOS.
  14560.  
  14561.  
  14562.  
  14563. INSTALLING CHARACTER DEVICES
  14564.  
  14565.   One of the functions defined for each device is INIT. This routine is called
  14566. only once when the device is installed and never again. The INIT routine returns
  14567. the following:
  14568.  
  14569. A) A location to the first free byte of memory after the device driver, like a
  14570.    TSR that is stored in the terminating address field. This way, the
  14571.    initialization code can be used once and then thrown away to save space.
  14572. B) After setting the address field, a character device driver can set the status
  14573.    word and return.
  14574.  
  14575.  
  14576.  
  14577. INSTALLING BLOCK DEVICES
  14578.  
  14579.  Block devices are installed in the same way as character devices. The
  14580. difference is that block devices return additional information. Block devices
  14581. must also return:
  14582.  
  14583. A) The number of units in the block device. This number determines the logical
  14584.    names the devices will have. For example, if the current logical device
  14585.    letter is F at the time of the install call, and the block device driver INIT
  14586.    routine returns three logical units, the letters G, H, and I are assigned to
  14587.    the units. The mapping is determined by the position of the driver in the
  14588.    device list and the number of units in the device. The number of units
  14589.    returned by INIT overrides the value in the name/unit field of the device
  14590.    header.
  14591.  
  14592. B) A pointer to a BPB (BIOS Parameter Block) pointer array. This is a pointer
  14593.    to an array of "N" word pointers there "N" is the number of units defined.
  14594.    These word pointers point to BPBs. This way, if all of the units are the
  14595.    same, the entire array can point to the same BPB to save space.
  14596.     The BPB contains information pertinent to the devices such as the sector
  14597.    size, number of sectors per allocation unit, and so forth. The sector size of
  14598.    the BPB cannot be greater than the maximum allotted size set at DOS
  14599.    initialization time. This array must be protected below the free pointer set
  14600.     by the return.
  14601.  
  14602. C) The media descriptor byte. This byte is passed to devices so that they know
  14603.    what parameters DOS is currently using for a particular drive unit.
  14604.  
  14605.  Block devices can take several approaches. They can be "dumb" or "smart". A
  14606. dumb device would define a unit (and therefore a BPB) for each possible media
  14607. drive combination. Unit 0=drive 0;single side, unit 1=drive 0;double side, etc.
  14608. For this approach, the media descriptor bytes would mean nothing. A smart
  14609. device would allow multiple media per unit. In this case, the BPB table
  14610. returned at INIT must define space large enough to acommodate the largest
  14611. possible medias supported (sector size in BPB must be as large as maximum
  14612. sector size DOS is currently using). Smart drivers will use the media
  14613. descriptor byte to pass information about what media is currently in a unit.
  14614.  
  14615.  
  14616.  
  14617. REQUEST HEADER├────────────────────────────────────────────────────────────────
  14618.  
  14619.  The request header passes the information describing what DOS wants the
  14620. device driver to do.
  14621.  When a valid device driver command code or function is called by your
  14622. application program, DOS develops a data structure called the "Request Header"
  14623. in ES:BX and passes it to the strategy entry point. This structure consists of
  14624. a 13-byte defined header which may be followed by other data bytes depending on
  14625. the function requested.
  14626.  It is the device driver's responsibility to preserve the machine state, for
  14627. example, saving all registers including flags on entry and restoring them on
  14628. exit. There is enough room on the stack when strategy or interrupt is called
  14629. to do about 20 pushes. If more stack is needed, the driver should set aside
  14630. its own stack space.
  14631.  The fixed ("static") part of the request header is as follows:
  14632.  
  14633. ┌────────────────────────────────────────────────────────────────────────────┐
  14634. │                        R E Q U E S T    H E A D E R                        │
  14635. ├───────┬───────┬────────────────────────────────────────────────────────────┤
  14636. │Offset │Length │                      F i e l d                             │
  14637. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  14638. │  00h  │  byte │ Length in bytes of the request header plus any data at end │
  14639. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  14640. │  01h  │  byte │ Unit code. Determines subunit to use in block devices      │
  14641. │       │       │ (minor device)  Has no meaning for character devices       │
  14642. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  14643. │  02h  │  byte │ Command code                                               │
  14644. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  14645. │  03h  │  word │ Status                                                     │
  14646. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  14647. │  05h  │8 bytes│ Reserved for DOS                                           │
  14648. ├───────┼───────┼────────────────────────────────────────────────────────────┤
  14649. │  0Ch  │varies │ Data appropriate for the operation                         │
  14650. └───────┴───────┴────────────────────────────────────────────────────────────┘
  14651.  
  14652. REQUEST HEADER LENGTH FIELD
  14653.  
  14654.  The length in bytes of the total request header (0-255) plus any data at the
  14655. end of the header.
  14656.  
  14657.  
  14658. UNIT CODE FIELD
  14659.  
  14660.  The unit code field identifies which unit in a block device driver the request
  14661. is for. For example, if a block device driver has three units defined, then the
  14662. possible values of the unit code field would be 0, 1, and 2. This field is not
  14663. valid for character devices.
  14664.  
  14665.  
  14666. COMMAND CODE FIELD
  14667.  
  14668.  The command code invokes a specific device driver function. Functions 0
  14669. through 12 are supported in all device drivers. Functions 13-15 are available
  14670. only in DOS 3.0 or higher. Some functions are relevant for either character or
  14671. block devices but not both; nonetheless all functions must have an executable
  14672. routine present even if it does nothing but set the done flag in the return
  14673. status word in the request header.
  14674.  
  14675.  The command code field in the request header can have the following values:
  14676. ┌──────┬──────────────────┬────────────────────────────────────────────────────┐
  14677. │ code │       name       │                     function                       │
  14678. ├──────┼──────────────────┼────────────────────────────────────────────────────┤
  14679. │   0  │ INIT             │ initialize driver for later use (used once only)   │
  14680. │   1  │ MEDIA CHECK      │ block devices only, NOP for character devices      │
  14681. │   2  │ BUILD BPB        │ block devices only, NOP for character devices      │
  14682. │   3  │ IOCTL input      │ called only if device has IOCTL bit set            │
  14683. │   4  │ INPUT            │ read data                                          │
  14684. │   5  │ NONDESTRUCTIVE INPUT NO WAIT  character devices only                  │
  14685. │   6  │ INPUT STATUS     │ character devices only                             │
  14686. │   7  │ INPUT FLUSH      │ character devices only                             │
  14687. │   8  │ OUTPUT           │ write data                                         │
  14688. │   9  │ OUTPUT           │ write data with verify                             │
  14689. │  10  │ OUTPUT STATUS    │ character devices only                             │
  14690. │  11  │ OUTPUT FLUSH     │ character devices only                             │
  14691. │  12  │ IOCTL OUTPUT     │ called only if device has IOCTL bit is set         │
  14692. │  13  │ DEVICE OPEN      │ called only if OPEN/CLOSE/RM bit is set            │
  14693. │  14  │ DEVICE CLOSE     │ called only if OPEN/CLOSE/RM bit is set            │
  14694. │  15  │ REMOVEABLE MEDIA │ only if OPEN/CLOSE/RM bit set & device is block    │
  14695. │  16  │ OUTPUT UNTIL BUSY│ only called if bit 13 is set & device is character │
  14696. └──────┴──────────────────┴────────────────────────────────────────────────────┘
  14697.  
  14698.  The individual command codes are described later in this chapter.
  14699.  
  14700.  
  14701.  
  14702. STATUS FIELD
  14703.  
  14704.  The status word field is zero on entry and is set by the driver interrupt
  14705. routine on return.
  14706.  
  14707. The status field in the request header contains:
  14708.  
  14709. ┌─────────────────────────────────────────────────────────────────────────────┐
  14710. │            D E V I C E    D R I V E R    S T A T U S    F I E L D           │
  14711. ├───────┬───┬─────────────────────────────────────────────────────────────────┤
  14712. │ size  │bit│                        definition                               │
  14713. ├───────┼───┼─────────────────────────────────────────────────────────────────┤
  14714. │ byte  │ 0 │                                                                 │
  14715. │       │ 1 │                                                                 │
  14716. │       │ 2 │                                                                 │
  14717. │       │ 3 │  Error message return code                                      │
  14718. │       │ 4 │  (with bit 15=1)                                                │
  14719. │       │ 5 │                                                                 │
  14720. │       │ 6 │                                                                 │
  14721. │       │ 7 │                                                                 │
  14722. ├───────┼───┼─────────────────────────────────────────────────────────────────┤
  14723. │ byte  │ 8 │  DONE                                                           │
  14724. │       ├───┼─────────────────────────────────────────────────────────────────┤
  14725. │       │ 9 │  BUSY                                                           │
  14726. │       ├───┼─────────────────────────────────────────────────────────────────┤
  14727. │       │ A │  Reserved by DOS, unknown                                       │
  14728. │       │ B │                                                                 │
  14729. │       │ C │                                                                 │
  14730. │       │ D │                                                                 │
  14731. │       │ E │                                                                 │
  14732. │       ├───┼─────────────────────────────────────────────────────────────────┤
  14733. │       │ F │  Error                                                          │
  14734. └───────┴───┴─────────────────────────────────────────────────────────────────┘
  14735.  
  14736.  
  14737.  The low 8 bits of the status word define an error message if bit 15 is set.
  14738. These errors are:
  14739.  
  14740.         00h  write protect violation   01h  unknown unit
  14741.         02h  device not ready          03h  unknown command
  14742.         04h  CRC error                 05h  bad drive request structure length
  14743.         06h  seek error                07h  unknown media
  14744.         08h  sector not found          09h  printer out of paper
  14745.         0Ah  write fault               0Bh  read fault
  14746.         0Ch  general failure           0Dh  reserved
  14747.         0Eh  reserved                  0Fh  invalid disk change
  14748.  
  14749. BIT 8   is the done bit. If it is set, it means the operation is complete. The
  14750.         driver sets the bit to 1 when it exits.
  14751.  
  14752. BIT 9   is the busy bit. It is only set by status calls and the removable media
  14753.         call.
  14754.  
  14755. BITS 10-14 are reserved.
  14756.  
  14757. BIT 15  is the error bit. If this bit is set, the low 8 bits of the status word
  14758.         (7-0) indicate the error code.
  14759.  
  14760.  
  14761. RESERVED FOR DOS
  14762.  Official sources label this area as "reserved for DOS". Another source
  14763. indicates that this consists of two double-word (4-byte) pointers to be used
  14764. to maintain a linked list of request headers for this device and a list of all
  14765. current device requests being processed by DOS. This was apparently to be used
  14766. for the undelivered multitasking version of DOS.
  14767.  
  14768.  
  14769.  
  14770. DEVICE DRIVER FUNCTIONS├───────────────────────────────────────────────────────
  14771.  
  14772.  All strategy routines are called with ES:BX pointing to the request header.
  14773. The interrupt routines get the pointers to the request header from the queue
  14774. the strategy routines stores them in. The command code in the request header
  14775. tells the driver which function to perform.
  14776.  
  14777. NOTE: All DWORD pointers are stored offset first, then segment.
  14778.  
  14779.                          ############################
  14780.  
  14781. INIT
  14782. Command code = 0        (all devices)
  14783.         Performs all initialization required at DOS boot time to install the
  14784.         driver and set local driver variables. This function is called only
  14785.         once, when the driver is loaded.
  14786.  
  14787.         ES:BX   pointer to 26-byte request header and data structure
  14788.  Format of structure:
  14789.        offset     length          field
  14790.          00h    13 bytes   request header
  14791.          0Dh       byte    number of units (not set by character devices)
  14792.          11h       dword   ending address of the driver's resident code
  14793.          15h       dword   pointer to BPB array (not set by character devices)
  14794.                            /pointer to remainder of arguments
  14795.          19h       byte    drive number (DOS 3.0+ only)
  14796.  
  14797.  
  14798.  When INIT is called, the driver must do the following:
  14799.  
  14800.         A) set the number of units (block devices only)
  14801.         B) set up the pointer to the BPB array (block devices only)
  14802.         C) perform any initialization code (to modems, printers, etc)
  14803.         D) set the ending address of the resident program code
  14804.         E) set the status word in the request header
  14805.  
  14806.  To obtain information obtained from CONFIG.SYS to a device driver at INIT
  14807. time, the BPB pointer field points to a buffer containing the information
  14808. passed from CONFIG.SYS following the =. The buffer that DOS passes to the
  14809. driver at INIT after the file specification contains an ASCII string for the
  14810. file OPEN. The ASCII string (ending in 0h) is terminated by a carriage return
  14811. (0Dh) and linefeed (0Ah). If there is no parameter information after the file
  14812. specification, the file specification is immediately followed by a linefeed
  14813. (0Ah).
  14814.  
  14815.  NOTE: This information is read-only and only system calls 01h-0Ch and 30h can
  14816.        be issued by the INIT code of the driver.
  14817.  
  14818.  The last byte parameter contains the drive letter for the first unit of a
  14819. block driver. For example, 0=A, 1=B etc.
  14820.  
  14821.  If an INIT routine determines that it cannot set up the device and wants to
  14822. abort without using any memory, follow this procedure:
  14823.  
  14824.         A) set the number of units to 0
  14825.         B) set the ending offset address at 0
  14826.         C) set the ending offsret segment address to the code segment (CS)
  14827.  
  14828. NOTE: If there are multiple device drivers in a single memory image file, the
  14829.       ending address returned by the last INIT called is the one DOS uses. It is
  14830.       recommended that all device drivers in a single memory image file return
  14831.       the same ending address.
  14832.  
  14833.                          ############################
  14834.  
  14835. MEDIA CHECK
  14836. command code = 1        (block devices only)
  14837.         Checks to see if disk had been changed since last access.
  14838.  
  14839.         ES:BX   pointer to 19-byte request header and data structure
  14840.  Format of structure:
  14841.         offset  length          field
  14842.         00h     13 bytes   request header
  14843.         0Dh        byte    media descriptor from BPB
  14844.         0Eh        byte    returned
  14845.         0Fh       dword    returns a pointer to the previous volume ID (if bit
  14846.                            11=1 and disk change is returned) (DOS 3.0+)
  14847.  
  14848.  When the command code field is 1, DOS calls MEDIA CHECK for a drive unit and
  14849. passes its current media descriptor byte. See "Media Descriptor Byte" later in
  14850. this chapter for more information about the byte. MEDIA CHECK returns one of
  14851. the following:
  14852.  
  14853.         A) media not changed             C) not sure
  14854.         B) media changed                 D) error code
  14855.  
  14856. The driver must perform the following:
  14857.         A) set the status word in the request header
  14858.         B) set the return byte
  14859.                 00h   don't know if media has been changed
  14860.                 01h   media has not been changed
  14861.                 -1    media has been changed
  14862.  
  14863.  DOS 3.0+: If the driver has set the removable media bit 11 of the device header
  14864. attribute word to 1 and the driver returns -1 (media changed), the driver must
  14865. set the DWORD pointer to the previous volume identification field. If DOS
  14866. determines that the media changed is an error, DOS generates an error 0Fh
  14867. (invalid disk change) on behalf of the device. If the driver does not implement
  14868. volume identification support, but has bit 11 set to 1, the driver should set a
  14869. pointer to the string "NO NAME",0.
  14870.  
  14871.  
  14872. MEDIA DESCRIPTOR
  14873.  Currently the media descriptor byte has been defined for a few media types.
  14874. This byte should be identical to the media byte if the device has the non-IBM
  14875. format bit off. These predetermined values are:
  14876.  
  14877. media descriptor byte =>    1  1  1  1  1  0  0  0
  14878.  (numeric order)            7  6  5  4  3  2  1  0
  14879.  
  14880.        BIT                MEANING
  14881.  
  14882.         0       0       not double sided
  14883.                 1       double sided
  14884.         1       0       not 8 sector
  14885.                 1       8 sector
  14886.         2       0       nonremoveable
  14887.                 1       removeable
  14888.        3-7      must be set to 1
  14889.  
  14890.                          ############################
  14891.  
  14892. BUILD BPB (BIOS Parameter Block)
  14893. command code = 2        (block devices only)
  14894.  
  14895.         ES:BX   pointer to 22-byte request header and data structure
  14896.  Format of structure:
  14897.         offset   length          field
  14898.         00h     13 bytes   request header
  14899.         0Dh        byte    media descriptor from DOS
  14900.         0Eh       dword    transfer address (buffer address)
  14901.         12h       dword    pointer to BPB table
  14902.  
  14903. DOS calls BUILD BPB under the following two conditions:
  14904.  
  14905. A) If "media changed" is returned.
  14906. B) If "not sure" is returned. If so, there are no used buffers. Used buffers
  14907.    are buffers with changed data that have not yet been written to the disk.
  14908.  
  14909. The driver must do the following:
  14910.  
  14911. A) set the pointer to the BPB.
  14912. B) set the status word in the request header.
  14913.  
  14914.  The driver must determine the correct media type currently in the unit to
  14915. return the pointer to the BPB table. The way the buffer is used (pointer
  14916. passed by DOS) is determined by the non-IBM format bit in the attribute field
  14917. of the device header. If bit 13=0 (device is IBM compatible), the buffer
  14918. contains the first sector of the FAT (most importantly the FAT ID byte). The
  14919. driver must not alter this buffer in this case. If bit 13=1 the buffer is a
  14920. one sector scratch area which can be used for anything.
  14921.  
  14922.  For drivers that support volume identification and disk change, the call
  14923. should cause a new volume identification to be read off the disk. This call
  14924. indicates that the disk has been legally changed.
  14925.  
  14926.  If the device is IBM compatible, it must be true that the first sector of the
  14927. first FAT is located at the same sector for all possible media. This is
  14928. because the FAT sector is read before the media is actually determined.
  14929.  
  14930.  The information relating to the BPB for a particular media is kept in the boot
  14931. sector for the media. In particular, the format of the boot sector is:
  14932.  
  14933. ┌──────────────────────────────────────────────────────────────────────────────┐
  14934. │ For DOS 2.x, 3 byte near jump (0E9h) For DOS 3.x+, 2 byte near jump (0EBh)   │
  14935. │ followed by a NOP (90h)                                                      │
  14936. ├──────────┬───────────────────────────────────────────────────────────────────┤
  14937. │ 8 bytes  │  OEM name and version                                             │
  14938. ├──────────┼─────┬─────────────────────────────────────────────────────────────┤
  14939. │   BYTE   │     │  sectors per allocation unit (must be a power of 2)         │
  14940. ├──────────┤     ├─────────────────────────────────────────────────────────────┤
  14941. │   WORD   │  B  │  reserved sectors (strarting at logical sector 0)           │
  14942. ├──────────┤     ├─────────────────────────────────────────────────────────────┤
  14943. │   BYTE   │     │  number of FATs                                             │
  14944. ├──────────┤     ├─────────────────────────────────────────────────────────────┤
  14945. │   WORD   │  P  │  max number of root directory entries                       │
  14946. ├──────────┤     ├─────────────────────────────────────────────────────────────┤
  14947. │   WORD   │     │  number of sectors in logical image (total number of        │
  14948. │          │     │  sectors in media, including boot sector directories, etc.) │
  14949. ├──────────┤  B  ├─────────────────────────────────────────────────────────────┤
  14950. │   BYTE   │     │  media descriptor                                           │
  14951. ├──────────┤     ├─────────────────────────────────────────────────────────────┤
  14952. │   WORD   │     │  number of sectors occupied by a single FAT                 │
  14953. ├──────────┼─────┴─────────────────────────────────────────────────────────────┤
  14954. │   WORD   │  sectors per track                                                │
  14955. ├──────────┼───────────────────────────────────────────────────────────────────┤
  14956. │   WORD   │  number of heads                                                  │
  14957. ├──────────┼───────────────────────────────────────────────────────────────────┤
  14958. │   WORD   │  number of hidden sectors                                         │
  14959. └──────────┴───────────────────────────────────────────────────────────────────┘
  14960.  
  14961.  The three words at the end return information about the media. The number of
  14962. heads is useful for supporting different multihead drives that have the same
  14963. storage capacity but a different number of surfaces. The number of hidden
  14964. sectors is useful for drive partitioning schemes.
  14965.  
  14966.                          ############################
  14967.  
  14968. INPUT / OUTPUT  (IOCTL)
  14969. command code = 3   IOCTL Read
  14970.                4   Read              (block or character devices)
  14971.                8   Write             (block or character devices)
  14972.                9   Write With Verify
  14973.               12   IOCTL Write
  14974.               16   Output Until Busy (character devices only)
  14975.  
  14976.         ES:BX   pointer to 24-byte request header and data structure
  14977.  
  14978.   Format of structure:
  14979.         offset    length          field
  14980.         00h     13 bytes     request header
  14981.         0Dh        byte      media descriptor byte from BPB
  14982.         0Eh       dword      transfer address (buffer address)
  14983.         12h        word      byte/sector count
  14984.         14h        word      starting sector number (block devices)
  14985.                              [no meaning on character devices]
  14986.         16h       dword      (DOS 3.0+) pointer to the volume ID if error code
  14987.                              0Fh is returned
  14988.  
  14989. The driver must perform the following:
  14990.         A) set the status word in the request header
  14991.         B) perform the requested function
  14992.         C) set the actual number of sectors or bytes tranferred
  14993.  
  14994.  No error checking is performed on an IOCTL I/O call. However, the driver must
  14995. set the return sector or byte count to the actual number of bytes transferred.
  14996.  
  14997.  Under certain circumstances a block device driver may be asked to do a write
  14998. operation of 64k bytes that seems to be a "wrap around" of the transfer address
  14999. in the BIOS I/O packet. This arises due to an optimization added to write code
  15000. in DOS. It will only happen in writes that are within a sector size of 64k on
  15001. files that are being extended past the current end of file. It is allowable for
  15002. the device driver to ignore the balance of the write that wraps around, if it
  15003. so chooses. For example, a write of 10000h bytes worth of sectors with a
  15004. transfer address of XXX:1 ignores the last two bytes. A user program can never
  15005. request an I/O of more than 0FFFFh bytes and cannot wrap around (even to 0) in
  15006. the transfer segment, so in that case the last two bytes can be ignored.
  15007.  
  15008.  A program that uses DOS function calls can never request an input or output
  15009. function of more than 0FFFFh bytes, therefore, a wrap around in the transfer
  15010. (buffer) segment can never occur. It is for this reason you can ignore bytes
  15011. that would have wrapped around in the tranfer segment.
  15012.  
  15013.  If the driver returns an error code of 0Fh (invalid disk change) it must put
  15014. a DWORD pointer to an ASCIIZ string which is the correct volume ID to ask the
  15015. user to reinsert the disk.
  15016.  
  15017. DOS 3.0+:
  15018.  The reference count of open files on the field (maintained by the OPEN and
  15019. CLOSE calls) allows the driver to determine when to return error 0Fh. If there
  15020. are no open files (reference count=0) and the disk has been changed, the I/O
  15021. is all right, and error 0Fh is not returned. If there are open files
  15022. (reference count > 0) and the disk has been changed, an error 0Fh condition
  15023. may exist.
  15024.  
  15025.                          ############################
  15026.  
  15027. NONDESTRUCTIVE INPUT NO WAIT
  15028. command code = 5        (character devices only)
  15029.         Reads a character from input stream but does not remove it from the
  15030.         buffer
  15031.  
  15032.         ES:BX   pointer to 14-byte request header and data structure
  15033.  Format of structure:
  15034.         offset    length          field
  15035.         00h     13 bytes   request header
  15036.         0Dh        byte    read from device
  15037.  
  15038. The driver must do the following:
  15039.         A) return a byte from the device
  15040.         B) set the status word in the request header.
  15041.  
  15042.  If the character device returns busy bit=0 (characters in the buffer), then
  15043. the next character that would be read is returned. This character is not removed
  15044. form the buffer (hence the term nondestructive input). This call allows DOS to
  15045. look ahead one character.
  15046.  
  15047.                          ############################
  15048.  
  15049. STATUS
  15050. command codes =  6   Input Status      (character devices only)
  15051.                 10   Output Status     (character devices only)
  15052.         Check for characters waiting in input buffer
  15053.  
  15054.         ES:BX   pointer to 13-byte request header
  15055.  
  15056. This driver must perform the following:
  15057.         A) perform the requested function
  15058.         B) set the busy bit
  15059.         C) set the status word in the request header.
  15060.  
  15061. The busy bit is set as follows:
  15062.  
  15063.  For input on unbuffered character devices: if the busy bit (bit 9) is 1 on
  15064. return, a write request would wait for completion of a current request. If the
  15065. busy bit is 0, there is no current request. Therefore, a write request would
  15066. start immediately.
  15067.  
  15068.  For input on buffered character devices: if the busy bit is 1 on return, a
  15069. read request does to the physical device. If the busy bit is 0, there are
  15070. characters in the device buffer and a read returns quickly. It also indicates
  15071. that a user has typed something. DOS assumes all character devices have a type-
  15072. ahead input buffer. Devices that do not have this buffer should always return
  15073. busy=0 so that DOS does not hang waiting for information to be put in a buffer
  15074. that does not exist.
  15075.  
  15076.                          ############################
  15077.  
  15078. FLUSH INPUT BUFFERS
  15079. command code = 7        (character devices only)
  15080.         Forces all data in buffers to specified device.
  15081.  
  15082.         ES:BX   pointer to 13-byte request header
  15083.  
  15084.  This call tells the driver to flush (terminate) all pending requests that it
  15085. has knowledge of. Its primary use is to flush the input queue on character
  15086. devices.
  15087.  
  15088.  The driver must set the status word in the request header upon return.
  15089.  
  15090.                          ############################
  15091.  
  15092. FLUSH OUTPUT BUFFERS
  15093. command code 11         (character devices only)
  15094.         Forces all data in buffers to specified device.
  15095.  
  15096.         ES:BX   pointer to 13-byte request header
  15097.  
  15098.  
  15099.  This call tells the driver to flush all output buffers and discards any
  15100. pending requests. Its primary use is to flush the output queue on character
  15101. devices.
  15102.  
  15103.  The driver must set the status word in the request header upon return.
  15104.  
  15105.                          ############################
  15106.  
  15107. OPEN or CLOSE  (DOS 3.0+)
  15108. command code = 13   Open      (block or character devices)
  15109.                14   Close     (block or character devices)
  15110.  
  15111.         ES:BX   pointer to 13-byte static request header
  15112.  
  15113.  These calls are designed to give the device information about the current file
  15114. activity on the device if bit 11 of the attribute word is set. On block
  15115. devices, these calls can be used to manage local buffering. The device can keep
  15116. a reference count. Every OPEN causes the device to increment the reference
  15117. count. Every CLOSE causes the device to decrement the reference count. When the
  15118. reference count is 0, if means there are no open files in the device. Therefore,
  15119. the device should flush buffers inside the device it has written to because now
  15120. the user can change the media on a removeable media drive. If the media had been
  15121. changed, it is advisable to reset the reference count to 0 without flushing the
  15122. buffers. This can be thought of as "last close causes flush". These calls are
  15123. more useful on character devices. The OPEN call can be used to send a device
  15124. initialization string. On a printer, this could cause a string to be sent to set
  15125. the font, page size, etc. so that the printer would always be in a known state
  15126. in the I/O stream. Similarly, a CLOSE call can be used to send a post string
  15127. (like a form feed) at the end of an I/O stream. Using IOCTL to set these pre and
  15128. post strings provides a flexible mechanism of serial I/O device stream control.
  15129.  
  15130.  Since all processes have access to STDIN, STDOUT, STDERR, STDAUX, and STDPRN
  15131. (handles 0, 1, 2, 3, and 4) the CON, AUX, and PRN devices are always open.
  15132.  
  15133.                          ############################
  15134.  
  15135. REMOVABLE MEDIA  (DOS 3.0+)
  15136. command code = 15       (block devices only)
  15137.         This call identifies the media type as removable or nonremovable.
  15138.  
  15139.         ES:BX   pointer to 13-byte static request header
  15140.  
  15141.  To use this call, set bit 11 (removable media) of the attribute field to 1.
  15142. Block devices can only use this call through a subfunction of the IOCTL
  15143. function call (int 21h fn44h).
  15144.  This call is useful because it allows a utility to know whether it is dealing
  15145. with a nonremovable media drive or with a removable media drive. For example,
  15146. the FORMAT utility needs to know whether a drive is removable or nonremovable
  15147. because it prints different versions of some prompts.
  15148.  
  15149. note    No error checking is performed. It is assumed that this call always
  15150.         succeeds.
  15151.  
  15152.  
  15153. THE CLOCK$ DEVICE├─────────────────────────────────────────────────────────────
  15154.  
  15155.  To allow a clock board to be integrated into the system for TIME and DATE,
  15156. the CLOCK$ device is used. This device defines and performs functions like any
  15157. other character device (most functions will be reset done bit, reset error bit,
  15158. and return). When a read or write to this device occurs, 6 bytes are
  15159. transferred. The first 2 bytes are a word, which is the count of days since
  15160. 01-01-80. The third byte is minutes, the fourth is hours, the fifth is
  15161. hundredths of a second, and the sixth is seconds.
  15162.  
  15163.  Reading the CLOCK$ device gets the date and time, writing to it sets the date
  15164. and time. CLOCK$ is normally called only when the system is initializing or if
  15165. the system time and date are set (DOS 3.3+). DOS carries the system time and
  15166. date internally after receiving it from the CLOCK$ driver.
  15167.  
  15168.  
  15169.  
  15170.  
  15171.  
  15172.        **  Programmer's Technical Reference for MSDOS and the IBM PC **
  15173.                 USA copyright TXG 392-616  ALL RIGHTS RESERVED
  15174. ───────────────────────────────┤ DOSREF (tm) ├────────────────────────────────
  15175.                      ISBN 1-878830-02-3 (disk-based text)
  15176.                     Copyright (c) 1987, 1992 Dave Williams
  15177.  
  15178.  
  15179.                                  C R E D I T S
  15180.  
  15181.  The information presented here was gathered from megabytes of files found on
  15182. BBS systems, conversations on a dozen different BBS systems, correspondence,
  15183. and every reference book I could get my hands on. On occasion, a number of
  15184. prestigious references didn't agree with each other. Where this has happened, I
  15185. have used the latest references. There is too much information here for me to
  15186. verify every fact personally. I have used my own judgement as to the
  15187. reliability of the sources.
  15188.  
  15189.  I've been selling copies of the Reference since October 1987.  The original
  15190. basis for the Reference came from Peter Norton's "Programmer's Guide to the
  15191. IBM PC" and the original Janet Jack interrupt list circa sometime 1986, as
  15192. updated by Ross Greenberg, plus a copy of the IBM DOS 3.1 Technical Reference.  
  15193. It's grown a bit, eh?  Anyway, I've prepared a list of the sources I've used
  15194. for the Reference to clear up any curiosity as to where the material came 
  15195. from.
  15196.  
  15197.  
  15198.  
  15199. Tools used in preparing this book:
  15200.  
  15201.  
  15202. Microsoft SymDeb, the final gasp of venerable DEBUG.COM and a fine program.
  15203.  
  15204. Microsoft CodeView, huge and awkward though it may be.
  15205.  
  15206. V Communications Sourcer, the only effective disassembler I've found.
  15207.  
  15208.  
  15209.  
  15210. References used in preparing this book:
  15211.  
  15212.  
  15213. AST EEMS Technical Reference Manual v3.2
  15214.         documents 020022-001B and 000408-001B
  15215.         provided by AST Corporation, 1987
  15216.  
  15217. AT&T 6300 Plus Hardware Reference Manual
  15218.         p/n 999-300-194IS
  15219.         from AT&T Corp, 1985 (before the Death Star logo, yet...)
  15220.  
  15221. Calculus EZ-FAX Developer's Toolkit
  15222.         copy 1990, Calculus
  15223.  
  15224. Creative Labs Sound Blaster User Reference Manual
  15225.         copr. 1989
  15226.  
  15227. Data General Programmer's Reference for MS-DOS, Rev.3
  15228.         Data General Corporation             (covers through DOS 3.0)
  15229.         p/n 069-100157 rev 00 May 1986
  15230.  
  15231. Digital Research DR-DOS System and Programmer's Guide v3.32
  15232.         Digital Research Corporation 1988
  15233.         comment: This manual does not cover the extended disk partition access,
  15234.                  file password protection, or any of the other goodies
  15235.                  provided in DR-DOS. In fact, it not only doesn't cover the
  15236.                  extended features, it doesn't completely cover DOS calls
  15237.                  documented by IBM. It does have an extensive section on
  15238.                  customizing DR-DOS for use from ROM.
  15239.  
  15240. Digital Research DR-DOS User's Guide v3.32
  15241.         Digital Research Corporation 1988
  15242.  
  15243. Digital Research DR-DOS Reference Guide v3.32
  15244.         Digital Research Corporation 1988
  15245.  
  15246. Digital Research DR-DOS Users and Reference Guide v3.40
  15247.         Digital Research Corporation, January 1989
  15248.  
  15249. Digital Research DR Multiuser DOS Users and Reference Guide v5.0
  15250.         Digital Research Corporation, 1991
  15251.  
  15252. Digital Research DR-DOS Users and Reference Guide v5.0
  15253.         Digital Research Corporation, 1991
  15254.  
  15255. DPMI 0.9 Specification
  15256.         Intel Corp, 1990
  15257.  
  15258. DPMI 1.0 Specification
  15259.         Intel Corp, 1991
  15260.  
  15261. An Introduction to the DOS Protected Mode Interface
  15262.         Software Focus Group
  15263.         Intel Corp, March 1991   order # 240787-002
  15264.  
  15265. IBM DOS Operations Manual Version 2.00
  15266.         IBM Corp, 1983
  15267.  
  15268. IBM DOS Operations Manual Version 2.10
  15269.         IBM Corp, 1983
  15270.  
  15271. IBM DOS Operations Manual Version 3.1
  15272.         IBM Corp, November 1984
  15273.  
  15274. IBM DOS Operations Manual Version 3.3
  15275.         IBM Corp, April 1987
  15276.  
  15277. IBM DOS Technical Reference, Version 4.0
  15278.         IBM Corp, 1988
  15279.  
  15280. IBM DOS Command Reference, Version 4.0
  15281.         p/n 6280254
  15282.         IBM Corp, 1988
  15283.  
  15284. IBM PC 3270 Emulation Program Entry Level Version 1.10
  15285. User's Guide
  15286.         pn 84X0280
  15287.         IBM Corp, 1986
  15288.  
  15289. IBM PC 3270 Emulation Program Entry Level Version 1.10
  15290. HLLAPI Programmer's Guide
  15291.         pn 84X0301
  15292.         IBM Corp, 1986
  15293.  
  15294. IBM PC Local Area Network Program Version 1.20
  15295.         IBM Corp, April 1987
  15296.  
  15297. IBM Technical Reference
  15298.         Options and Adapters - Enhanced Graphics Adapter
  15299.         p/n 6280131  IBM Publications Aug 1984
  15300.  
  15301. IBM Technical Reference
  15302.         Personal Computer
  15303.         p/n 6322507 IBM Publications
  15304.  
  15305. IBM Technical Reference
  15306.         Personal Computer - PCjr
  15307.         p/n 1502293 IBM Publications
  15308.  
  15309. LANtastic Programmer's Information Package, 2/21/89
  15310.  
  15311. Logitech Mouse Programmer's Toolkit
  15312.         Logitech Corp. 1986
  15313.  
  15314. Lotus-Intel-Microsoft Expanded Memory Specification Version 3.20
  15315.         part number 300275-003
  15316.         provided by Intel Corp.  September, 1985
  15317.  
  15318. Lotus-Intel-Microsoft Expanded Memory Specification 4.0
  15319.         document 300275-005
  15320.         provided by Intel Corp.  October 1987
  15321.  
  15322. Lotus-Intel-Microsoft Expanded Memory Specification 4.0
  15323. EMS Toolkit for C Developers
  15324.         document 302243-001
  15325.         provided by Intel Corp, February 1990
  15326.  
  15327. Microsoft - various documents provided to MS 5.0 beta testers
  15328.  
  15329. Microsoft Extended Memory Specification v2.00
  15330.         provided by Microsoft Corporation,  1988
  15331.  
  15332. Microsoft Mouse Technical Reference
  15333.         Microsoft Press, 1989
  15334.  
  15335. Microsoft Virtual DMA Specification 1.0
  15336.         Microsoft Part # 098-10869  May 1, 1990 
  15337.  
  15338. Mouse Systems Programmer's Toolkit
  15339.         p/n 302449-001 Rev A, 1989
  15340.         p/n 302375-100, 1989
  15341.         p/n 302446-100, 1989
  15342.  
  15343. MS-DOS Programmer's Reference                (covers through DOS 2.00)
  15344.         by Microsoft
  15345.         p/n 135555-001 Intel Corp. 1984
  15346.  
  15347. MS-DOS 5.0 Programmer's Reference            (covers DOS 5.0 only)
  15348.         by Microsoft
  15349.         Microsoft Press 1991, ISBN 1-55615-329-5
  15350.  
  15351. Phar Lap Virtual Control Program Interface (VCPI) Specification v1.0
  15352.         Phar Lap Software 1989
  15353.  
  15354. Phoenix System BIOS for PC/XT/AT and Compatibles
  15355.         Addison Wesley, 1987
  15356.  
  15357. Phoenix System BIOS for PC/XT/AT and Compatibles (Second edition)
  15358.         Addison Wesley, 1991
  15359.  
  15360. Tandy 1000 TX Technical Reference Manual
  15361.         Tandy Corp.
  15362.         p/n 25-1514  Tandy Corp 1987
  15363.  
  15364. The Software Link
  15365.         PC-MOS 4.1 Programmer's Reference (1990)
  15366.  
  15367. Toshiba 1000 Technical Reference Manual
  15368.         Toshiba Corp. of America 1987
  15369.  
  15370. Tseng Labs EVA Chipset Programming Guide
  15371.         Tseng Labs, 1986
  15372.  
  15373. X3.4-1977: American National Standard Code for Information Interchange
  15374.         by American National Standards Institute (ANSI)
  15375.         New York, NY  1977
  15376.  
  15377. Weitek ABACUS Software Designer's Guide, Doc 8967
  15378.         September 1989
  15379.  
  15380. Wendin-DOS Programmer's Reference
  15381.         Wendin, Inc, 1987
  15382.  
  15383. **********************
  15384.  
  15385. ATI EGA Wonder Operation Manual
  15386.         ATI Technologies, 1987
  15387.  
  15388. Everex EV-650 EGA Reference Guide, Version 1.00
  15389.         Everex Computer, 1986
  15390.  
  15391. FastCard IV User Manual
  15392.         Peripheral Marketing Inc.
  15393.         p/n 0527        Jan 1987
  15394.  
  15395. Hercules Graphics Card User's Manual
  15396.         Hercules Computer Technology
  15397.         1983
  15398.  
  15399. Hercules Graphics Card Plus Owner's Manual
  15400.         Hercules Computer Technology
  15401.         Model GB112  1987
  15402.  
  15403. JDR B-3101 FLoppy Disk Drive Card User's Guide
  15404.         470.03002 version 1.00    1988
  15405.  
  15406. LANtastic 2.46 Installation Guide
  15407.         Artisoft, 1988
  15408.  
  15409. LANtastic 3.01 Installation Guide
  15410.         Artisoft, 1990
  15411.  
  15412. LANtastic 4.0 beta Installation Guide
  15413.         Artisoft, 1991
  15414.  
  15415. LapLink Release 2 User's Manual
  15416.         Traveling Software, 1987
  15417.  
  15418. LapLink Release 3 User's Manual
  15419.         Traveling Software, 1989
  15420.  
  15421. Logitech EGA Reference Manual, EGA+Mouse Board
  15422.  
  15423. Mirage Super VGA TVGA-8900 User's Manual
  15424.  
  15425. MPC Operations Guide,  Manual #1023
  15426.         Columbia Data Products, Inc.
  15427.         CDP  1983
  15428.  
  15429. Microcomputer Products - 1987 Data Book
  15430.         NEC Electronics, Inc.
  15431.         p/n 500105      Aug 1987
  15432.  
  15433. NEC uPD70108/70116 Microprocessor User's Manual
  15434.         p/n 500350      October 1986
  15435.         provided by NEC Electronics, Inc.
  15436.  
  15437. Novell Advanced Netware System Manager's Reference
  15438.  
  15439. pcAnywhere User's Guide v2.00
  15440.         Dynamic Microprocessor Associates, Inc  1986
  15441.  
  15442. S-286 User Manual, version 2
  15443.         Link Computer, 1988
  15444.  
  15445. STB VGA Extra/EM
  15446.         EM-16 BIOS Features
  15447.         STB Corp.
  15448.  
  15449. TesSeRact v1.0 documentation
  15450.  
  15451. TCXL 5.1 documentation
  15452.  
  15453. Toshiba ND352/356 3.5" Diskette Drive Installation Notes
  15454.         document number 87019   March 1988
  15455.         Toshiba America Corporation
  15456.  
  15457. Tseng Labs
  15458.         EVA, EVA/480 BIOS Guide
  15459.         November 10, 1988
  15460.  
  15461. VESA Toolkit v2.0
  15462.         summer 1991
  15463.  
  15464. VideoTrax Installation Guide
  15465.         Alpha Micro, 1987
  15466.  
  15467. ******************
  15468.  
  15469. Advanced MSDOS
  15470.         Ray Duncan
  15471.         Microsoft Press  1986
  15472.  
  15473. Assembly Language Programming for the IBM Personal Computer
  15474.         David J. Bradley
  15475.         Prentice-Hall   1984
  15476.  
  15477. Assembly Language Subroutines for MSDOS Computers
  15478.         Leo J. Scanlon
  15479.         TAB Books   1986
  15480.  
  15481. Atari ST Internals
  15482.         Gerits, English, & Bruckmann
  15483.         Abacus Software  1985
  15484.  
  15485. Compute!'s Guide to Assembly Language Programming on the IBM PC
  15486.         COMPUTE! Publications
  15487.  
  15488. Compute!'s Mapping the IBM PC and PCjr
  15489.         Russ Davis
  15490.         COMPUTE! Publications
  15491.  
  15492. DOS Power Tools
  15493.         Paul Somerson
  15494.         Bantam Books  1988
  15495.  
  15496. DOS: The Complete Reference
  15497.         Kris Jamsa
  15498.         Osborne/McGraw-Hill  1987
  15499.  
  15500. Exploring the IBM PCjr
  15501.         Peter Norton
  15502.         Microsoft Press  1984
  15503.  
  15504. Discovering the IBM PCjr
  15505.         Peter Norton
  15506.         Microsoft Press  1984
  15507.  
  15508. DOS 5: A Developer's Guide
  15509.         Al Williams
  15510.         M&T Books, 1991
  15511.  
  15512. IBM Video Subsystems
  15513.         Richard Wilton
  15514.         Microsoft Press  1988
  15515.  
  15516. Inside the IBM PC
  15517.         Peter Norton
  15518.  
  15519. Mapping the IBM PC
  15520.         Russ Davies/Compute! Magazine
  15521.         Compute! Books   1986
  15522.  
  15523. Memory Resident Utilities, Interrupts, and Disk Management With MS & PC DOS
  15524.         Michael Hyman
  15525.         MIS Press  1987
  15526.  
  15527. Microcomputer Interfacing
  15528.         Bruce A. Artwick
  15529.         Prentice Hall   1980
  15530.  
  15531. Microsoft Systems Journal - March 1987
  15532.         "Expanded Memory: Writing Programs that Break the 640k Barrier"
  15533.         Marion Hansen, Bill Krueger, Nick Stuecklen
  15534.  
  15535. MS-DOS Encyclopedia
  15536.         Ray Duncan
  15537.         Microsoft Press 1988  (first edition)
  15538.  
  15539. Network Programming in C
  15540.         Barry Nance  (barryn on BIX)
  15541.         Que, 1990
  15542.  
  15543. Operating Systems Design and Implementation
  15544.         Arthur S. Tanenbaum
  15545.         Prentice Hall 1987
  15546.  
  15547. Programmer's Guide to the IBM PC
  15548.         Peter Norton
  15549.         Microsoft Press  1985
  15550.  
  15551. Programmer's Problem Solver for the IBM PC, XT, & AT
  15552.         Robert Jourdain
  15553.         Prentice Hall  1986
  15554.  
  15555. Programming Windows
  15556.         Charles Petzold
  15557.         Microsoft Press, 1987
  15558.  
  15559. Programming Windows, Second Edition
  15560.         Charles Petzold
  15561.         Microsoft Press, 1990
  15562.  
  15563. Running MS-DOS
  15564.         Van Wolverton
  15565.         Microsoft Press
  15566.  
  15567. Supercharging MS-DOS
  15568.         Van Volverton
  15569.         Microsoft Press  1986
  15570.  
  15571. The 8080a Bugbook
  15572.         Tony-Larsen-Titus
  15573.         Howard W. Sams   1977
  15574.  
  15575. The 8086 Book
  15576.         Russell Rector and George Alexy
  15577.         Osborne/McGraw-Hill  1980
  15578.  
  15579. The IBM Personal Computer from the Inside Out
  15580.         Murray Sargent III and Richard L. Shoemaker
  15581.         Addison-Wesley  1984
  15582.  
  15583. The IBM ROM BIOS
  15584.         Ray Duncan
  15585.         Microsoft Press  1988
  15586.  
  15587. The Serious Assembler
  15588.         Charles A. Crayne and Dian Gerard
  15589.         Baen Books   1985
  15590.  
  15591. Tricks of the MS-DOS Masters
  15592.         Waite Group
  15593.         Howard W. Sams  1987
  15594.  
  15595. Turbo Pascal Express
  15596.         Robert Jourdain
  15597.         Brady Books, 1987
  15598.  
  15599. Writing DOS Device Drivers in C
  15600.         Adams/Tondo
  15601.         Prentice Hall, 1990
  15602.  
  15603. ***********************
  15604.  
  15605. Microsoft Macro Assembler 4.0, 5.1 documentation
  15606.  
  15607. Microsoft C 4.0 documentation
  15608.  
  15609. Borland Turbo Pascal 3.02a and 5.0 documentation, Turbo C 2.0 documentation
  15610.  
  15611. Novell SFT System Administrator's Reference
  15612.  
  15613. ***************************
  15614.  
  15615.  Western Digital, Rodime, Miniscribe, Microscience, Adaptec, Storage
  15616. Technologies, and Connor Peripherals were kind enough to send spec sheets on
  15617. most of their products which helped to expand and verify the hard drive
  15618. information in Appendix 6.
  15619.  
  15620. ***************************
  15621.  
  15622.  A large amount of miscellaneous information came from various computer
  15623. magazines. Documenting what came from where would be an experience all its
  15624. own. A great deal of information came from articles by Michael Mefford and
  15625. Charles Petzold of PC Magazine, and Neil Rubenking, Jeff Duntemann, and
  15626. Ray Duncan, who get around a lot.
  15627.  
  15628.    Byte
  15629.         ( Byte's kinda weird. They have some really neat, well-researched
  15630.           stuff interspersed with mindless drivel.  Still, they print some
  15631.           stuff you absolutely, positively won't find anywhere else. )
  15632.  
  15633.    C'T (Computer Technik)
  15634.         ( If you read German, this one is sorta like PC Magazine was in its
  15635.           heyday. )
  15636.  
  15637.    Computer Language
  15638.         ( I never decided if I liked CL or not.  Maybe I'm not the sort of
  15639.           programmer they're writing for... )
  15640.  
  15641.    Computer Shopper
  15642.         ( Though primarily advertising, some information sneaks in from time
  15643.           to time. )
  15644.  
  15645.    Dr. Dobb's Journal
  15646.         ( I always thought the old title, "Doctor Dobbs' Journal of Computer
  15647.           Calisthenics and Orthodontia - Running Light Without Overbyte" was
  15648.           a killer name, but nobody asked me. )
  15649.  
  15650.    InfoWorld
  15651.         ( I never really figured out how a weekly magazine could so often be
  15652.           both late *and* wrong with their stories, but IW tries hard. Still,
  15653.           you often hear about rumblings you'd never find out about in the
  15654.           slicks. The National Enquirer of the computer world? )
  15655.  
  15656.    Micro Cornucopia
  15657.         ( R.I.P - it was great while it lasted. )
  15658.  
  15659.    Microsoft Systems Journal
  15660.         ( Hideously expensive and mostly oriented to Windows, the
  15661.           early issues had some really good stuff )
  15662.  
  15663.    Midnight Engineering
  15664.         ( This one's hard to classify.  It's hardcore computer with a dash
  15665.           of entrepreneurship, bizarre as the combination may sound.  I like
  15666.           it when I can find it. )
  15667.  
  15668.    PC Magazine
  15669.         ( Despite their new "management format" in mid '89, PC Mag still has
  15670.           some good techie stuff from time to time. I guess the bean counters
  15671.           thought managers were more important than programmers. )
  15672.  
  15673.    PC Resource
  15674.         ( There was rarely anything of interest in PC Resource, but every
  15675.           now and then I found something. Now defunct. )
  15676.  
  15677.    PC Tech Journal
  15678.         ( "Tell 'em what you're going to say, tell 'em what you're saying, tell
  15679.           'em what you just said." - and don't send us no steenking submissions
  15680.           unless they're in WordPerfect format! Despite their fascist policies,
  15681.           every now and then they printed something useful. The Little Rock
  15682.           Wild Bunch refered to it as "PC Tech Urinal," an apt monicker. Now
  15683.           defunct. )
  15684.  
  15685.    PC Techniques
  15686.         ( This is the magazine PC Tech Journal tried to advertise itself as.
  15687.           Pure programming, written by programmers for programmers, without
  15688.           too many "journalists" pissing in the text. Try it! )
  15689.  
  15690.    PC Week
  15691.         ( This one used to be a clone of InfoWorld, but since their takeover
  15692.           by PC Magazine they've become a sort of mutant cross between IW
  15693.           and PCMag. )
  15694.  
  15695.    Programmer's Journal
  15696.         ( This is a nice magazine, though expensive. - now defunct )
  15697.  
  15698.    Tech Specialist
  15699.         ( One of the few really good magazines for bit-twiddlers.  Haven't
  15700.           seen a GUI phone-dialer shootout yet! )
  15701.  
  15702. ****************************
  15703.  
  15704. various computer bulletin board systems, including
  15705.  
  15706. Byte Information Exchange (BIX)
  15707.  (check out ibm.dos/old.secrets.2 and ibm.dos/secrets.3)
  15708.  
  15709.  Effusive thanks to the gang in the ibm.exchange - these guys are *sharp*.
  15710.  In alphabetic order:
  15711.  
  15712.  barryn, billn, bkep, daiken, dgh, dmick, dnanian, dondumitru,
  15713.  drifkind, geary, glass, gmussar, greenber, hfishman, j_vanderbilt,
  15714.  jndunlap, jlussmeyer, johnf, jsloman, jsprowl, jswitzer, jrichards,
  15715.  mike123, mheller, rbabcock, rbrukardt, rduncan, roedy, sjgrant,
  15716.  skluger, terjem, twagner, wardc, wcowley, and all the guys whose
  15717.  names forgot... <grin>
  15718.  
  15719. Compuserve's Microsoft beta forums
  15720.  
  15721. FIDOnet international network       (various technical echos)
  15722.  
  15723. GEnie IBM RT and Borland RT
  15724.  
  15725. NorthAmericaNet (NaNet) programming echos
  15726.  
  15727. Canada Remote Systems               (Toronto, Canada)
  15728.  
  15729. RIME PCRelay international network  (IBM, Technical, Programming echos)
  15730.  
  15731. TelePath (M&T Publishing)
  15732.  
  15733. ...plus I hit the various Wildnet, and GT-Net echos from time to time!
  15734.  
  15735. *********************************
  15736.  
  15737. The following text files were of use. Bear in mind that some of them may be
  15738. seen under several different names. The author's name is given as it appears
  15739. in the documentation (if any).  As you can see, this stuff predated the
  15740. ARC-vs-ZIP wars...
  15741.  
  15742. 10H-BUG  ASM     4680  29/01/87 bug in 2.x int 21h/fn10h             Ray Duncan
  15743.  
  15744. 1PT4MB   INF     5120   3/10/87 1.44Mb drives         Clyde Washburn 70305,1211
  15745.  
  15746. 2EH      ASM     2969   3/03/87 info on undoc'd int 2Eh           David Gwillim
  15747.  
  15748. 386BUG   ARC     9216  15/10/87 bug in early 80386 chips           Compaq Corp.
  15749.  
  15750. 8086     3      10572   5/12/88 dump of Fidonet?? 8086 conf??         <no name>
  15751.  
  15752. 8259     ARC     2826  15/03/88 info on 8259 chip                     <no name>
  15753.  
  15754. APICALLS ARC    11481   8/01/88 OS/2 API function call list          Bill Earle
  15755.  
  15756. ASM-ADRS ARC     6144  20/12/87 low memory vectors         Malcolm McCorquodale
  15757.  
  15758. ATCMDS   ARC     3072  20/03/88 Hayes 1200 baud command set           <no name>
  15759.  
  15760. BACKDOOR UPL    26115  11/12/89 "back door" through PSP            John Switzer
  15761.  
  15762. BIOSDOC  ARC    34816   3/11/87 very good function list         David E. Powell
  15763.  
  15764. BIXDOS1  ARC   155648  14/12/87 BIX "MSDOS Secrets" #1                <no name>
  15765.  
  15766. BUG40DOS ARC     3200  18/08/88 bugs in DOS 4.0                          "Doug"
  15767.  
  15768. CAS      ARC    33792  27/10/88 Communicating Applications Standard 1.0A
  15769.                                                                 DCA, Intel Corp
  15770.  
  15771. CCPM86   ARC    68238  14/10/89 list of Concurrent CP/M calls         <no name>
  15772.  
  15773. CDOS     ARC    35584  18/07/89 list of Concurrent DOS calls         Guy Scharf
  15774.  
  15775. CDOS2_   ARC   227200  18/07/89 list of Concurrent DOS calls      J. F. Jankura
  15776.  
  15777. CDOSCALL ARC    19968  18/07/89 list of Concurrent DOS calls      J. F. Jankura
  15778.  
  15779. CNBDOC   ZIP    32012   9/02/91 CBIS Net Bios Programmer's Ref.    Tom Thompson
  15780.  
  15781. CUFEXT   ARC    13228  13/03/90 common file extensions               J.W. Rider
  15782.  
  15783. DEBUGTUT ARC    15655  23/04/88 DEBUG tutorial                        <no name>
  15784.                                                         possibly David Whitman?
  15785.  
  15786. DIAGNOSE ARC    14336   1/01/86 memory errcodes  Jerry Schneider, Arnold Kischi
  15787.  
  15788. DISK144  ARC    23086  16/10/88 info on 1.44Mb diskettes              <no name>
  15789.  
  15790. DISKTYPE ARC     5073  14/04/88 IBM floppy formats                    <no name>
  15791.  
  15792. DOOM     ARC     9216  29/09/88 hard drive information                <no name>
  15793.  
  15794. DOS-SIZE ARC      787  27/03/88 size of DOS files 1.1-3.1             <no name>
  15795.  
  15796. DOS3TXT  ARX     9168  31/07/85 list of DOS/BIOS ints, data areas   Dan Rollins
  15797.  
  15798. DOS32    ARC    17408  31/05/88 command list for DOS 3.2              <no name>
  15799.  
  15800. DOS3BUGS ARC     5639  15/10/87 acknowledged bugs in DOS 3.0-3.2      IBM Corp.
  15801.  
  15802. DOS40    ARC    15625  22/07/88 IBM announcement of DOS 4.0           IBM Corp.
  15803.  
  15804. DOS401   ARC    18178  19/10/88 errors in DOS 4.0                     IBM Corp.
  15805.  
  15806. DOS40B   ARC    27008  26/08/88 Compuserve thread on DOS 4.0          <no name>
  15807.  
  15808. DOS40FAT ARC     1510  11/09/88 DOS 4.0 File Allocation Table       Mike Austin
  15809.  
  15810. DOS40FUN ZOO     3410  31/12/99 DOS 4.0 int 24, 25, etc               Pat Myrto
  15811.  
  15812. DOS40HLP ARC    53376  28/08/88 DOS 4.0 command set                   <no name>
  15813.  
  15814. DOS40TXT ARC    46169  16/10/88 DOS 4.0 problems & info               <no name>
  15815.  
  15816. DOS4TIPS ARC     1735  19/09/88 problems with DOS 4.0                 IBM Corp.
  15817.  
  15818. DOSBUG   TXT     1024  15/10/87 info on 2.0 volume label              <no name>
  15819.  
  15820. DOSGUIDE ARC    21344  21/02/88 DOS tutorial                Carrington B. Dixon
  15821.  
  15822. DOSINT   ARC     4201  15/03/88 list of DOS 2.0 function calls     John Chapman
  15823.  
  15824. DOSNOTES ARC     5052  15/03/88 info on DOS undoc fns.                <no name>
  15825.  
  15826. DOSREF   ARC     9216  21/01/87 partial list of PC BIOS calls         <no name>
  15827.  
  15828. DOSREF   ARC    62052  23/08/86 device driver info                    "Cracker"
  15829.  
  15830. DOSTIPS  ARC    28926  15/03/88 info on DOS                        John Chapman
  15831.  
  15832. DOSTIPS1 ARC   159657  25/11/85 various DOS info                   Dean R. Wood
  15833.  
  15834. DOSTIPS3 ARC    59264  25/01/88 various DOS tips (different)       Dean R. Wood
  15835.  
  15836. DOSUNDOC ARC     3840  03/05/86 one of the very first interrupt lists
  15837.                                                            Spyros Sakellariadis
  15838.  
  15839. DRIVPARM ARC    11264   7/01/88 info on DRIVPARM parameters      Joan Friendman
  15840.  
  15841. EGATEK   ARC     8704  15/03/88 IBM EGA registers                   Bill Frantz
  15842.  
  15843. EMS40BIX ARC     3802  21/09/87 BIX announcement of EMS 4.0                 BIX
  15844.  
  15845. ENVIRONM ARC     4255  18/09/88 info on DOS environment           Jan Fagerholm
  15846.  
  15847. ESC_CODE ARC     3072   3/10/88 Laserjet setup codes                     S. Noh
  15848.  
  15849. FILEIO   ARC     8192  24/07/88 TSRs and INDOS flag                   <no name>
  15850.  
  15851. FLOPPIES ARC     9216   2/11/87 info on floppy media                 Ted Jensen
  15852.  
  15853. FOSSIL   ARC     9031  15/07/87 list of FOSSIL functions       Vincent Periello
  15854.  
  15855. FXN4BH   ASM     4503   1/01/80 odd 4Bh behavior                     Ray Duncan
  15856.  
  15857. HAYESET2 ARC     6479   4/09/86 modem commands         Ruth Lubow, Fowler Brown
  15858.  
  15859. HD-DATA  ARC     4096  19/07/87 list of hard drives & specs           <no name>
  15860.                                 I've seen many similar files. I believe the
  15861.                                 original may have been a file or bulletin on
  15862.                                 Sparta BBS
  15863.  
  15864. HDINFO   ARC    11264  19/11/87 updated version of above, evidently by someone
  15865.                                 else                                  <no name>
  15866.  
  15867. HDNOISE  ARC     4159  11/11/87 hard disk information             Clancy Malloy
  15868.  
  15869. HDTIPS   ARC     9660  11/10/87 hard disk information              Barry Gordon
  15870.  
  15871. IBMTAB   ARC     7882  15/03/88 general IBM PC tech info            John S. Lou
  15872.  
  15873. IBMTECH  ARC   136064   4/11/88 error codes, other info               IBM Corp.
  15874.  
  15875. INT-MDOS ARC    20682  31/07/85 one of the original INT lists    Ross Greenberg
  15876.  
  15877. INTER189 LZH   156368  25/06/89 interrupt list                       Ralf Brown
  15878.  
  15879. INTERRUP ARC   157440  19/09/88 interrupt vector list                Ralf Brown
  15880.  
  15881. INTERRPT ARC    42632   4/04/88 interrupt vector list         Marshall Presnell
  15882.                                 this is a very nice list and some programming
  15883.                                 information. If I'd come across it way back
  15884.                                 then it would have saved a ton of typing <sigh>
  15885.  
  15886. JARGON   ARC    49274  16/07/88 dictionary of computer terms          <no name>
  15887.  
  15888. LE_MCLCK.ASM     3489   3/27/86  undoc'd Leading Edge BIOS fns      Bob Plouffe
  15889.  
  15890. LIM-40   ARC    21504  15/10/87 info on LIM 4.0                Stephen Satchell
  15891.  
  15892. LISTINTS ARC     6144   3/12/87 small interrupt list                  <no name>
  15893.  
  15894. MCB      ARC     5120  24/07/88 info on DOS Memory Control Blocks David Gwillim
  15895.  
  15896. MNP-TEXT ARC     6144  30/09/88 MNP modem info                       Mike Focke
  15897.  
  15898. MOUSENG  ARC    10240  13/08/88 Norton Guide file for mouse programming, with
  15899.                                 C examples                            <no name>
  15900.  
  15901. MSLOOKUP ARC    58368  25/12/87 interrupt and function listing     Frank Bonita
  15902.  
  15903. MS-OS2   ARC    25600  15/10/87 MS press release on OS/2        Microsoft Corp.
  15904.  
  15905. MSINT125 ARC    48128  12/01/88 interrupt vector listing             Ralf Brown
  15906.  
  15907. MDOSDOC  EXE    47104   4/21/91 MultiDos Plus 4.00 Prog. Ref.     Nanosoft Inc.
  15908.  
  15909. NETBIOS  ARC    17280  29/10/88 NetBIOS tutorial & summary         Tom Thompson
  15910.  
  15911. NOVELINT ARC     4531  18/10/88 NetBIOS calls                        Marc Guyot
  15912.  
  15913. OCOM_520 ARC    53632  19/08/88 FOSSIL tutorial and functions        Rick Moore
  15914.  
  15915. ODDITY   ARC     3072  24/07/88 int 2Eh description               Daniel Briggs
  15916.  
  15917. PINS     ARC     3072  18/01/88 pinouts of various connectors         <no name>
  15918.  
  15919. QUES40   ARC     9081   1/09/88 info on DOS 4.0                       IBM Corp.
  15920.  
  15921. RAW_COOK ARC     2048  15/10/87 info on DOS raw and cooked modes      <no name>
  15922.  
  15923. RESETSWT TXT     3584  23/01/86 add a reset switch to a PC          Don Jenkins
  15924.  
  15925. RLLHINTS ARC    12288  17/10/87 RLL controller info                 Steve Sneed
  15926.  
  15927. RLLMISC  ARC     5120  17/10/87 info on RLL controllers        Richard Driggers
  15928.  
  15929. RLLSTORY ARC     9718  31/07/88 good info on RLL coding           Pete Holzmann
  15930.  
  15931. SEAGATE  ARC     2048   3/03/88 specs for many Seagate drives        Jim McKown
  15932.  
  15933. SECRETS2 ARC   179625  17/04/88 BIX "MS-DOS Secrets" #2               <no name>
  15934.  
  15935. SERCBL2  ARC     4372  16/10/88 serial cable pinouts                   Lee Zeis
  15936.  
  15937. SM2400   ARC     2296   9/08/86 Hayes 2400 baud command set           <no name>
  15938.  
  15939. SPOOL   DOC     29704  03/28/89 Versa-Spool API                     Jeff Newbro
  15940.  
  15941. SSTEP    ARC     2300  11/07/89 explanation of CPU single-step      Ed Burnette
  15942.  
  15943. ST225    ARC    11264   7/10/87 optimizing ST225 and WD cont.         Neil Erbe
  15944.  
  15945. TANDON   ARC     3612  21/02/88 info on Tandon drives             David Welcher
  15946.  
  15947. TECH     ARC    27827   8/05/88 misc tech info - Fidonet?             <no name>
  15948.  
  15949. TOOLS    C      14032   8/10/89 Grid laptop special functions  Fredrick Coffman
  15950.  
  15951. TOS               938  24/03/88 TOS function calls                Mike Crawford
  15952.  
  15953. TRYST    ARC    29312  29/10/88 DOS and hard disk info               Amy Goebel
  15954.  
  15955. UNDOCINT 21H     7168  14/04/87 undocumented DOS calls           Peter Holzmann
  15956.  
  15957. VESA     TXT    41269  01/17/90 VESA standard                              VESA
  15958.  
  15959. VGAKIT   DOC     7634  05/04/90 VGA programming kit                John Bridges
  15960.  
  15961. VGAPIN   ARC     1252  24/10/88 VGA pinout                               "Mike"
  15962.  
  15963. WD-27X   ARC     6144  10/10/87 WD 27X HD controller setup        Steve Shelton
  15964.  
  15965. WDCONFIG ARC     5504  11/10/87 WD-1002 WXS setup              Richard Driggers
  15966.  
  15967. WDCONT   ARC    11264  25/12/87 info on WD hard disk controllers    Peter Fales
  15968.  
  15969. XEB1210  ARC     7947  18/07/87 Xebec HD controller setup      Richard Driggers
  15970.  
  15971. XEBEC    ARC     1036  30/04/88 setup for Xebec HD controller  Richard Driggers
  15972.  
  15973. XEBECTEC ARC     1834  30/04/88 setup for Xebec 1210                  <no name>
  15974.  
  15975. XGADEMO  LZH    23552  01/27/91 IBM XGA programming info v.50        Bert Tyler
  15976.  
  15977. XMS      ARC    75776   1/08/88 Microsoft Extended Memory Specification 1.0
  15978.                                                           Microsoft Corporation
  15979.  
  15980. XTCHARTS ARC    12416   4/11/88 ports, charts                         <no name>
  15981.  
  15982.                       **********************************
  15983.  
  15984. NBRCV.C      Paul McGinnis      NetBIOS API calls
  15985.  
  15986. DESQ10.ASM   James H. LeMay     DesqView API calls
  15987.  
  15988. NETTUT.DOC   Charles L. Hedrick TCP/IP network
  15989.  
  15990. CED10D       Chris Dunford      CED interrupt calls
  15991.  
  15992. LANTSTIC.DOC LANtastic adware   peer-to-peer LAN calls
  15993.  
  15994. GLOSSARY.ARC no author name     computer terms
  15995.  
  15996. 4DOS.DOC     Tom Rawson         4DOS int 2Eh, 2Fh calls, SHELL= bug
  15997.  
  15998.  
  15999. DOSREF isn't a tutorial, and sometimes you need a tutorial.  Microsoft has
  16000. finally written a half-decent one - The MS-DOS Programmer's Reference,
  16001. Microsoft Press, 1991, ISBN 1-55615-329-5.  This is the DOS 5.0 Tech Ref.
  16002. It covers data structures and DOS programming concepts clearly.  However,
  16003. it has no information on other DOS versions, nor does it (of course) cover
  16004. undocumented calls.
  16005.  
  16006.                      ------------------------------------
  16007.  
  16008.  Nothing gets written in a vacuum, and I'd like to express my thanks to all
  16009. the people who have been good enough to furnish information and support:
  16010.    (in alphabetical order)
  16011.  
  16012. Tommy Apple, Mike Crawford, Herman Diagostino, Joe Felix, Ron Melson,
  16013. Denis Murphy, & Ben Sansing,
  16014.         who all loaned me documentation and reference material for so long
  16015.         that some of them have forgotten to ask for their stuff back
  16016.  
  16017.  
  16018.  And those people who were kind enough to help out:
  16019.  
  16020. Mike Blaszczak, MA:                                        (blaszczak on BIX)
  16021.         who went rampaging through work and client's sites to find and
  16022.         document various model ID bytes, plus plenty of information on MS OBJ
  16023.         file formats
  16024.  
  16025. Carl Bretteville, Drammen Norway:
  16026.         who sent me a complete Concurrent DOS Programmer's Reference,
  16027.         considerably enriching the Norwegian postal service thereby
  16028.  
  16029. Herman Diagostino, Manassas VA:
  16030.         who worked up the TECHMENU menu file and provided a copy of the
  16031.         rare IBM DOS 4.0 Technical Reference and a copy of the original MSDOS
  16032.         Encyclopedia from Microsoft, info on the Pelican 5.5mb floppy drive,
  16033.         IBM DOS 4.0 command reference, many hard drive specs, OS/2 DOS Box
  16034.         differences
  16035.  
  16036. James Drenter, Davenport IA:
  16037.         additional info on int 1Ch
  16038.  
  16039. David Dorling, Buderim, Australia:
  16040.         found one embarrassing error in the device driver info and provided
  16041.         many expansions and clarifications
  16042.  
  16043. Chris Dunford, Columbia MD:                                (CIS 76703,2002)
  16044.         who sent me a copy of the PCED 2.0 API and let me use his INTPROTO.TXT
  16045.  
  16046. Steve Grant, Jersey City NJ:                               (sjgrant on BIX)
  16047.         who granted permission to include his excellent SYSID program with my
  16048.         distribution disks, furnished several model IDs
  16049.  
  16050. Roedy Green, Vancouver BC Canada:                          (roedy on BIX)
  16051.         many names and addresses for Appendix 5, serial and parallel port
  16052.         details and cabling, granted permission to include some of his very
  16053.         educational essays with my distribution disks, plus many details on
  16054.         DOS disk I/O
  16055.  
  16056. David Holm                                                 (dgh on BIX)
  16057.         Reported minor error in int 15h/4Fh and some TI Pro oddities
  16058.  
  16059. Michael Koepke, Wood Dale IL:
  16060.         pinouts on EGA feature connector, PS/2 keyboard connector, DR-DOS
  16061.         programming information, much info on Digital's DR-DOS, and the loan
  16062.         of some of his books
  16063.  
  16064. Curt Lankford, Little Rock, AR:
  16065.         loaned his copy of the AT&T 6300 Plus Hardware Technical Reference
  16066.  
  16067. Alan R. Levinstone, Garland TX:
  16068.         80286 LOADALL instruction
  16069.         BIOS Data Area floppy control parameters 40:8B, 40:8F, 40:90
  16070.  
  16071. Brian Long, Twyford UK:
  16072.         provided a copy of the then-nearly-unavailable DPMI 0.9 specification,
  16073.         plus port and address info
  16074.  
  16075. Keith Meade, Rochester MN:                                 (keithm on BIX)
  16076.         who provided a Microsoft Windows 2.11 SDK, copy of IBM TopView
  16077.  
  16078. Feico Nater, Hengelo, Netherlands:
  16079.         additions to FCB calls, several pages of expansions and clarifications
  16080.  
  16081. Bruce Nevins, Tucson AZ:                                   (bnevins on BIX)
  16082.         Irwin low-level tape drive info, DEC PC info
  16083.  
  16084. Patrick O'Riva, San Jose CA:
  16085.         info on what happens to the interleave when the BIOS is finished, and
  16086.         for his interesting online assembly-language magazine
  16087.  
  16088. Klaus Overhage, Stuttgart W.Germany:
  16089.         FANSI-CONSOLE system calls, and translating the TechRef into German
  16090.  
  16091. Tom Rawson, MD:                                            (trawson on BIX)
  16092.         DOS device driver loading information
  16093.  
  16094. John Richards, England:                                    (jrichards on BIX)
  16095.         European DOS 4.0 information
  16096.  
  16097. Ben Sansing, Little Rock AR:
  16098.         ANSI.SYS information, documentation for the NEC V20/30 chips, reported
  16099.         error in register chart in Chapter 4, loaned his copy of PC-MOS/386
  16100.         for testing
  16101.  
  16102. Hans Schleichert, Marburg West Germany:
  16103.         information on int 2Fh, fn OAEh (internal DOS commands). Good thing
  16104.         I took some German in high school... <grin>
  16105.  
  16106. Paul Slootman, Borne, Netherlands
  16107.         RealTek VGA board video modes
  16108.  
  16109. John Switzer, CA:                                          (jswitzer on BIX)
  16110.         who allowed me to include his discoveries on alternate DOS entries
  16111.         and file mysteries. (see BACKDOOR.ZIP on BIX, or Oct 1990 Dr. Dobbs')
  16112.  
  16113. Fred Thompson, Rapid City SD:
  16114.         loaned his Sound Blaster manual, provided much info on graphics
  16115.         programming
  16116.  
  16117. Matt Trask:                                                (matt.trask on BIX)
  16118.         who donated a complete copy of the TopView Programmer's Reference
  16119.  
  16120. Richard Vogh, Marietta GA:
  16121.         found several embarrassing errors in the boot sector chart in Chapter
  16122.         8. The shame! The shame! <sigh>
  16123.  
  16124. Jim Wenzel, North Little Rock AR:
  16125.         more PC model ID codes, loaned his copy of the Windows 3.0 SDK
  16126.  
  16127.  
  16128. ...and these companies:
  16129.  
  16130. Alloy Computer Products, Marlborough MA:
  16131.         Joe Souza and Frank Gladu, who provided detailed information on the
  16132.         APIs for NTNX, ANSK, and 386 Multiware.
  16133.  
  16134. Artisoft, Tucson AZ:
  16135.         Eileen, Sherri, and the beta support people
  16136.  
  16137. Digital Research, Monterey CA:
  16138.         provided review copies of DR-DOS 5.0 and DRMDOS
  16139.  
  16140. H&R Block
  16141.         Michael Finney, who gave permission to reproduce the GIF89a standard
  16142.  
  16143. Microsoft Corporation, Redmond WA:
  16144.         for beta-test versions of DOS 5.0, Windows 3.1, other products,
  16145.         information on DOS 5 and the DOSSHELL API
  16146.  
  16147. NanoSoft, Natick MA:
  16148.         Jack van Schouwen, allowed the use of their API materials verbatim
  16149.  
  16150. The Software Link, Atlanta GA:
  16151.         provided a review copy of PC/MOS-386 and the programming guide
  16152.  
  16153. Qualitas, Bethesda MD:
  16154.         Bill, Andy, and all the gang
  16155.  
  16156. Quarterdeck, Santa Monica CA:
  16157.         Russ, Bob, Michael, and the guys in bet and tech support
  16158.  
  16159.  
  16160.  Special thanks to Chris Dunford, who donated his "CED" program to the public
  16161. domain. If it wasn't for CED, I would likely have abandoned MSDOS machines
  16162. entirely and bought a Macin...uh... something else; and to Haruyasu Yoshizaki
  16163. for allowing unrestricted use of his LHarc program used to compress the files
  16164. on these diskettes.
  16165.  
  16166.  
  16167.                                                         Dave Williams
  16168.                                                     --------------------
  16169.                                                       Jacksonville, AR
  16170.  
  16171.  
  16172.   ============================== I N V O I C E =================SWv2.3=======
  16173.  
  16174.   mail invoice to:                       SHIP TO:
  16175.  
  16176.    Dave Williams                     +----------------------------------------
  16177.       DOSREF                         |
  16178.     PO Box 181                       |
  16179.  Jacksonville, AR                    |
  16180.   72076-0181 USA                     |
  16181.                                      |
  16182.           Order #:                   |
  16183.           Date   :                   | E-Mail address:
  16184.           PO #   :                   |
  16185.                                      +----------------------------------------
  16186. ===============================================================================
  16187.   item  |    description                             |unit pr| qty |total price
  16188. ===============================================================================
  16189.  
  16190.           Programmer's Technical Reference            _______ _____ _____ _____
  16191.  
  16192.             USA:   $20
  16193.          Canada:   $25 CDN (checks)
  16194.                    $20 US  (postal money orders)
  16195.  United Kingdom:   £15                           check one:
  16196.     EuroCheques:   £15 UK
  16197.                                                        | | (1)  1.44m disk
  16198.   Cash, checks, or money orders are acceptable.        | | (1)  1.2mb disk
  16199.  
  16200.  
  16201. ===============================================================================
  16202.   Orders from other countries, please make payment            DOSREF  _$20.00__
  16203.   in one of the currencies listed above.
  16204.                                                  packing and postage  _$1.75___
  16205.  
  16206.        $1.25 extra charge for 3 x 360K [ ] or 2 x 720K [ ] diskettes  _________
  16207.  
  16208.   $10 surcharge for approved corporate or government purchase orders  _________
  16209.  
  16210.                                                                total  _________
  16211.  
  16212. or charge your American Express or VISA card:
  16213.  
  16214.  
  16215. name as it appears on card: _______________________________________________
  16216.  
  16217.  
  16218. billing address (required): _______________________________________________
  16219.  
  16220.  
  16221. account #:__________________________  expiration date: ____________________
  16222.  
  16223.  
  16224. signature: _______________________________ today's date: __________________
  16225.  
  16226.  
  16227. Where did you hear about DOSREF?  __________________________________________
  16228.  
  16229. Would you like a copy of the latest shareware version to upload or pass out
  16230. to friends or associates?
  16231.                               YES___   NO___
  16232.                                                             THANK YOU!
  16233.  
  16234.           --------------------  QUICK MAILER  ----------------------
  16235.             Please support quality shareware by your registration.
  16236.  
  16237.                           Thank you for your support!
  16238.  
  16239.                          DOSREF 2.3 Registration Form
  16240.  
  16241. make check or money order to:                   Dave Williams
  16242.                                                 PO Box 181  (DOSREF)
  16243. see INVOICE.TRF for foreign orders              Jacksonville AR 72076-0181 USA
  16244.  
  16245.                                                    unit price  
  16246.  
  16247.     Programmer's Technical Reference ................. $20
  16248.     surcharge for gov't or corporate POs ............. $10
  16249.     shipping and handling ............................ $1.75
  16250.                                                  Total $___________________
  16251. ------------fold------------ INSTANT REGISTRATION ---------here------------
  16252.  
  16253.  check disk type          | | (1) 5-1/4 inch, 1.2mb
  16254.                           | | (1) 3-1/2 inch, 1.44mb
  16255.  
  16256. Where did you hear about DOSREF? __________________________________________
  16257.  
  16258.                                  __________________________________________
  16259.  
  16260. Use Address on envelope ( )    check ( )    or:
  16261.  
  16262. Name     ___________________________________________________________________
  16263.  
  16264. Address  ___________________________________________________________________
  16265.  
  16266.          ___________________________________________________________________
  16267.  
  16268.          ___________________________________________________________________
  16269.  
  16270. E-MAIL:  ___________________________________________________________________
  16271.  
  16272.  Copy this file to the printer.  After the first page prints, you will have
  16273. to turn it over and print the back side for the address.
  16274.  
  16275.  Fold at the page break below with the printing facing out.  Then fold letter
  16276. style, putting this side in and the address side out. If necessary, staple
  16277. the check to the mailer, then staple or tape the sides and top.
  16278.  
  16279.  Check here if you would like a copy of the latest shareware version to
  16280. pass around or upload to a local BBS: _____
  16281.  
  16282.  
  16283.                                                THANK YOU!
  16284.  
  16285.  
  16286.                                                                    ---------
  16287. _________________________________                                 |         |
  16288.                                                                   |         |
  16289. _________________________________                                 |  Stamp  |
  16290.                                                                   |         |
  16291. _________________________________                                 |         |
  16292.                                                                    ---------
  16293.  
  16294.  
  16295.  
  16296.                                          Dave Williams
  16297.                                          PO Box 181   (DOSREF 2.3)
  16298.                                          Jacksonville, AR 72076-0181
  16299.                                          USA
  16300. DOSREF SWv2.3
  16301.  
  16302.